Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat kind of compiler magic do we need more?
    primarykey
    data
    text
    <p>I develop lot view models which are:</p> <p>1) All have to implement INotifyPropertyChanged to be bindable to UI. </p> <p>2) Property setters have to raise PropertyChanged on change.</p> <p>3) PropertyChanged event has to provide proper property name.</p> <p>If you (like me) tied of writing something like this:</p> <pre><code> public string Name { get { return _name; } set { if (_name != value) { _name = value; RaisePropertyChanged("Name"); } } } </code></pre> <p>Then refactor this method like this and sometimes forget to update property name literal:</p> <pre><code> string _fundName; public string FundName { get { return _fundName; } set { if (_fundName != value) { _fundName = value; RaisePropertyChanged("Name"); } } } </code></pre> <p>And then spend a day to debug why your UI is not refreshing and databinding doesn't work properly.</p> <p>Then all we need is some kind of magic.</p> <p>What if I just need to write this:</p> <pre><code> [Magic] // implicit transformation public string FundName { get; set; } </code></pre> <p>or if I have many properties:</p> <pre><code> [Magic] public class MyViewModel { public string FundName { get; set; } public string FundType { get; set; } [NoMagic] // suppress transformation public int InternalId { get; set; } } </code></pre> <p>So I have just developed a MSBuild task to do this magic after the build (<a href="http://kindofmagic.codeplex.com" rel="nofollow">http://kindofmagic.codeplex.com</a>).</p> <p>The question is, what kind of magical postprocessing would you like more?</p> <p>Does automatic implementation of INotifyPropertyChanging makes sense?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload