Marcello

My feedback

  1. 1 vote
    Vote
    Sign in
    (thinking…)
    Password icon
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    0 comments  ·  Visual Studio IDE » Languages - C#  ·  Flag idea as inappropriate…  ·  Admin →
    Marcello shared this idea  · 
  2. 4 votes
    Vote
    Sign in
    (thinking…)
    Password icon
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    1 comment  ·  Visual Studio IDE » Languages - C#  ·  Flag idea as inappropriate…  ·  Admin →
    Marcello supported this idea  · 
    Marcello commented  · 

    Why I voted it:

    Suppose that we have a property as:

    public double Thickness{get; set;}

    Now, we want to transform this simple value in a rich property that support changing value notifications or undo/redo methods or other rich implementations.
    We can create a custom class as:

    public class RichProperty<T>()
    public T Value{…}

    and use it we something similar to:

    public RichProperty<double> Thickness{get;} = new RichProperty<double>();

    This works good but is a little bit annoying write every time:

    x.Thickness.Value

    instead of

    x.Thickness

    Now we can write a custom cast operator to T and this is really good, now we can write:

    if(x.Thickness+1>..

    or

    double v = x.Thickness;

    But we can’t override the assign operator, so we can’t write:

    x.Thickness = 3d;
    or
    new x(){Thickness=3d};

    Look that, typically, the new property is read only, suppose now that we can write something similar to:

    public class RichProperty<T>()
    [DefaultProperty]
    public T Value{…}

    Now we can review this cases:

    x.Thickness = 3d;

    Thickness is a read only property, so we can’t assign it but, Thickness expose a default property for double value? Yes the the Value property so compiler can interpret it as:

    x.Thickness.Value = 3d;

    Same considerations for: new x(){Thickness=3d};

  3. 1 vote
    Vote
    Sign in
    (thinking…)
    Password icon
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    0 comments  ·  Visual Studio IDE » Languages - C#  ·  Flag idea as inappropriate…  ·  Admin →
    Marcello shared this idea  · 
  4. 6 votes
    Vote
    Sign in
    (thinking…)
    Password icon
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    3 comments  ·  Visual Studio IDE » Languages - C#  ·  Flag idea as inappropriate…  ·  Admin →
    Marcello commented  · 

    > I suppose, this can be solved on a library level. I don't see a need to add this to the core language.

    No. Only clr know that a value is assigned. At the moment is not possible to access this invormation if value owner don't implements specific evets or other trace strategies.

    Marcello commented  · 

    I hope that is evident that with this approach INotifyPropertyChanged problem (https://visualstudio.uservoice.com/forums/121579-visual-studio-2015/suggestions/2255378-inotifypropertychanged) will be obsolete because c# itself allow to track changes on all properties that implements or not INotifyPropertyChanged.

    In ex. Binding can ferify if the requested property implement INotifyPropertyChanged or can be traced. If not raise an error.

    Marcello shared this idea  · 
  5. 2,638 votes
    Vote
    Sign in
    (thinking…)
    Password icon
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    34 comments  ·  Visual Studio IDE » Languages - C#  ·  Flag idea as inappropriate…  ·  Admin →
  6. 6,013 votes
    Vote
    Sign in
    (thinking…)
    Password icon
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    192 comments  ·  Visual Studio IDE » Languages - C#  ·  Flag idea as inappropriate…  ·  Admin →
    Marcello supported this idea  · 

Feedback and Knowledge Base