<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Silverlight/WPF: Implementing PropertyChanged with Expression Tree</title>
	<atom:link href="http://michaelsync.net/2009/04/09/silverlightwpf-implementing-propertychanged-with-expression-tree/feed" rel="self" type="application/rss+xml" />
	<link>http://michaelsync.net/2009/04/09/silverlightwpf-implementing-propertychanged-with-expression-tree</link>
	<description>Sharing our knowledge</description>
	<lastBuildDate>Thu, 04 Mar 2010 13:05:49 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Oded Levy</title>
		<link>http://michaelsync.net/2009/04/09/silverlightwpf-implementing-propertychanged-with-expression-tree/comment-page-1#comment-197839</link>
		<dc:creator>Oded Levy</dc:creator>
		<pubDate>Fri, 25 Sep 2009 10:35:29 +0000</pubDate>
		<guid isPermaLink="false">http://michaelsync.net/?p=1309#comment-197839</guid>
		<description>In my previous comment i meant instead of writing:

this.RaisePropertyChanged( () =&gt; this.Name); 

you can write:

this.RaisePropertyChanged( () =&gt; this.Name); 

Regards</description>
		<content:encoded><![CDATA[<p>In my previous comment i meant instead of writing:</p>
<p>this.RaisePropertyChanged( () =&gt; this.Name); </p>
<p>you can write:</p>
<p>this.RaisePropertyChanged( () =&gt; this.Name); </p>
<p>Regards</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Oded Levy</title>
		<link>http://michaelsync.net/2009/04/09/silverlightwpf-implementing-propertychanged-with-expression-tree/comment-page-1#comment-197838</link>
		<dc:creator>Oded Levy</dc:creator>
		<pubDate>Fri, 25 Sep 2009 10:32:54 +0000</pubDate>
		<guid isPermaLink="false">http://michaelsync.net/?p=1309#comment-197838</guid>
		<description>Hi there,

Very nice work indeed. Though due to delegate inference you can eliminate the need for expressing the generic parameter type without extension methods. For example instead of writing:

this.RaisePropertyChanged( () =&gt; this.Name); 

you can write:

this.RaisePropertyChanged( () =&gt; this.Name); 

Regards</description>
		<content:encoded><![CDATA[<p>Hi there,</p>
<p>Very nice work indeed. Though due to delegate inference you can eliminate the need for expressing the generic parameter type without extension methods. For example instead of writing:</p>
<p>this.RaisePropertyChanged( () =&gt; this.Name); </p>
<p>you can write:</p>
<p>this.RaisePropertyChanged( () =&gt; this.Name); </p>
<p>Regards</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Avoiding string while raising or handling PropertyChanged event &#171; Mehroz&#8217;s Experiments</title>
		<link>http://michaelsync.net/2009/04/09/silverlightwpf-implementing-propertychanged-with-expression-tree/comment-page-1#comment-193506</link>
		<dc:creator>Avoiding string while raising or handling PropertyChanged event &#171; Mehroz&#8217;s Experiments</dc:creator>
		<pubDate>Wed, 26 Aug 2009 09:09:57 +0000</pubDate>
		<guid isPermaLink="false">http://michaelsync.net/?p=1309#comment-193506</guid>
		<description>[...] Expression Trees as described by Michael Sync and Davy [...]</description>
		<content:encoded><![CDATA[<p>[...] Expression Trees as described by Michael Sync and Davy [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Sync</title>
		<link>http://michaelsync.net/2009/04/09/silverlightwpf-implementing-propertychanged-with-expression-tree/comment-page-1#comment-178347</link>
		<dc:creator>Michael Sync</dc:creator>
		<pubDate>Mon, 15 Jun 2009 18:46:35 +0000</pubDate>
		<guid isPermaLink="false">http://michaelsync.net/?p=1309#comment-178347</guid>
		<description>Hi,

Yes. I did it. Please take a look at my comments from this post. There are two of my comments that I mentioned about the comparison.</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>Yes. I did it. Please take a look at my comments from this post. There are two of my comments that I mentioned about the comparison.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jsp3536</title>
		<link>http://michaelsync.net/2009/04/09/silverlightwpf-implementing-propertychanged-with-expression-tree/comment-page-1#comment-178346</link>
		<dc:creator>jsp3536</dc:creator>
		<pubDate>Mon, 15 Jun 2009 18:44:35 +0000</pubDate>
		<guid isPermaLink="false">http://michaelsync.net/?p=1309#comment-178346</guid>
		<description>Michael,

Did you ever run any test showing the performance impact on using the expression tree rather then just passing in the string name?</description>
		<content:encoded><![CDATA[<p>Michael,</p>
<p>Did you ever run any test showing the performance impact on using the expression tree rather then just passing in the string name?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Sync &#187; An Early Look at Silverlight Model-View-ViewModel Toolkit 1</title>
		<link>http://michaelsync.net/2009/04/09/silverlightwpf-implementing-propertychanged-with-expression-tree/comment-page-1#comment-178140</link>
		<dc:creator>Michael Sync &#187; An Early Look at Silverlight Model-View-ViewModel Toolkit 1</dc:creator>
		<pubDate>Sun, 14 Jun 2009 11:33:38 +0000</pubDate>
		<guid isPermaLink="false">http://michaelsync.net/?p=1309#comment-178140</guid>
		<description>[...] to use any magic string in property setter.  If you haven&#8217;t read it yet, please go and read this post to get some idea. I implemented the same implementation in ViewModelBase class of this toolkit so [...]</description>
		<content:encoded><![CDATA[<p>[...] to use any magic string in property setter.  If you haven&#8217;t read it yet, please go and read this post to get some idea. I implemented the same implementation in ViewModelBase class of this toolkit so [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Sync</title>
		<link>http://michaelsync.net/2009/04/09/silverlightwpf-implementing-propertychanged-with-expression-tree/comment-page-1#comment-168936</link>
		<dc:creator>Michael Sync</dc:creator>
		<pubDate>Sun, 03 May 2009 15:47:56 +0000</pubDate>
		<guid isPermaLink="false">http://michaelsync.net/?p=1309#comment-168936</guid>
		<description>Hey Roko!!  good to see you here... thanks for dropping by! man :) 

&gt;&gt;If performance is a key issue then Expression Tree based solution in this context will have some performance penalties as reflection is involved during the decoding of expressions

I think reflection and Expression Tree are different things.  I&#039;m not sure whether there are some performance penalties on using Expression Tree. Anyway, you brought good point. I will dottrace the performance..

We can use [NotifyPropertyChanged] attribute with PostSharp or Interception. But I personally don&#039;t like PostSharp that much since it makes my VS very slow. 

Interception (e.g. Unity Interception) might be good too but I haven&#039;t tried it yet. I found some samples that are using Unity Interception for that purpose..</description>
		<content:encoded><![CDATA[<p>Hey Roko!!  good to see you here&#8230; thanks for dropping by! man :) </p>
<p>>>If performance is a key issue then Expression Tree based solution in this context will have some performance penalties as reflection is involved during the decoding of expressions</p>
<p>I think reflection and Expression Tree are different things.  I&#8217;m not sure whether there are some performance penalties on using Expression Tree. Anyway, you brought good point. I will dottrace the performance..</p>
<p>We can use [NotifyPropertyChanged] attribute with PostSharp or Interception. But I personally don&#8217;t like PostSharp that much since it makes my VS very slow. </p>
<p>Interception (e.g. Unity Interception) might be good too but I haven&#8217;t tried it yet. I found some samples that are using Unity Interception for that purpose..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Roko</title>
		<link>http://michaelsync.net/2009/04/09/silverlightwpf-implementing-propertychanged-with-expression-tree/comment-page-1#comment-168294</link>
		<dc:creator>Roko</dc:creator>
		<pubDate>Thu, 30 Apr 2009 22:25:35 +0000</pubDate>
		<guid isPermaLink="false">http://michaelsync.net/?p=1309#comment-168294</guid>
		<description>Hei Mike, 

Good approach. You get rid off of passing hard coded string as property name which is good for producing clean code and killing the chance of mistyping the property name when raising the PropertyChanged event. 

Only one concern, If performance is a key issue then Expression Tree based solution in this context will have some performance penalties as reflection is involved during the decoding of expressions. And that PropertyChanged event will get called countless times during your application life cycle. In this scenario you get best possible performance by passing hard coded string as property name. But off course that hard coding doesn&#039;t look cool and can be error prone.

For now I only see one better solution that avoids both reflection at runtime and hard coded property name in your code as well; and that is by using postsharp aspect to auto implement INotifyPropertyChanged interface in any classes. You also get rid off code to manually raise the event in your classes. Your code will look like this

     /* aspect that auto implements INotifyPropertyChanged. You need to create it by overriding existing post sharp aspect */
     
     [NotifyPropertyChanged]
     public class Person  
    {  
        public string Name{ get; set; }  
        public int Age { get; set; }
    }  

Looks much cleaner right ?
     
The attribute/custom aspect will auto implement INotifyPropertyChanged for every single property you have and works excellent with WPF data binding without adding any extra performance overhead.

In case you are interested about listening to that propertychanged event from other classes you can do it like that....

INotifyPropertyChanged P = Person as INotifyPropertyChanged;  
    P.PropertyChanged += (sender, arg) =&gt; { /*  Your Event handling code goes here */ }; 


- Roko</description>
		<content:encoded><![CDATA[<p>Hei Mike, </p>
<p>Good approach. You get rid off of passing hard coded string as property name which is good for producing clean code and killing the chance of mistyping the property name when raising the PropertyChanged event. </p>
<p>Only one concern, If performance is a key issue then Expression Tree based solution in this context will have some performance penalties as reflection is involved during the decoding of expressions. And that PropertyChanged event will get called countless times during your application life cycle. In this scenario you get best possible performance by passing hard coded string as property name. But off course that hard coding doesn&#8217;t look cool and can be error prone.</p>
<p>For now I only see one better solution that avoids both reflection at runtime and hard coded property name in your code as well; and that is by using postsharp aspect to auto implement INotifyPropertyChanged interface in any classes. You also get rid off code to manually raise the event in your classes. Your code will look like this</p>
<p>     /* aspect that auto implements INotifyPropertyChanged. You need to create it by overriding existing post sharp aspect */</p>
<p>     [NotifyPropertyChanged]<br />
     public class Person<br />
    {<br />
        public string Name{ get; set; }<br />
        public int Age { get; set; }<br />
    }  </p>
<p>Looks much cleaner right ?</p>
<p>The attribute/custom aspect will auto implement INotifyPropertyChanged for every single property you have and works excellent with WPF data binding without adding any extra performance overhead.</p>
<p>In case you are interested about listening to that propertychanged event from other classes you can do it like that&#8230;.</p>
<p>INotifyPropertyChanged P = Person as INotifyPropertyChanged;<br />
    P.PropertyChanged += (sender, arg) =&gt; { /*  Your Event handling code goes here */ }; </p>
<p>- Roko</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vivek</title>
		<link>http://michaelsync.net/2009/04/09/silverlightwpf-implementing-propertychanged-with-expression-tree/comment-page-1#comment-164944</link>
		<dc:creator>Vivek</dc:creator>
		<pubDate>Sat, 18 Apr 2009 06:04:10 +0000</pubDate>
		<guid isPermaLink="false">http://michaelsync.net/?p=1309#comment-164944</guid>
		<description>Nice approach!
However I feel that this approach can be further refined taking advantage of the C# automatic properties and AOP(Aspect Oriented Programming). 
Use this link for reference http://richardsbraindump.blogspot.com/2009/02/aspect-oriented-programming.html.</description>
		<content:encoded><![CDATA[<p>Nice approach!<br />
However I feel that this approach can be further refined taking advantage of the C# automatic properties and AOP(Aspect Oriented Programming).<br />
Use this link for reference <a href="http://richardsbraindump.blogspot.com/2009/02/aspect-oriented-programming.html" rel="nofollow">http://richardsbraindump.blogspot.com/2009/02/aspect-oriented-programming.html</a>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian</title>
		<link>http://michaelsync.net/2009/04/09/silverlightwpf-implementing-propertychanged-with-expression-tree/comment-page-1#comment-164756</link>
		<dc:creator>Brian</dc:creator>
		<pubDate>Fri, 17 Apr 2009 11:28:33 +0000</pubDate>
		<guid isPermaLink="false">http://michaelsync.net/?p=1309#comment-164756</guid>
		<description>Very nice, I really disliked the idea of using strings to notify property changes! 
Do Expression Trees use Reflection to perform these tricks? Just wondering as I generally try to avoid using Reflection at all costs.</description>
		<content:encoded><![CDATA[<p>Very nice, I really disliked the idea of using strings to notify property changes!<br />
Do Expression Trees use Reflection to perform these tricks? Just wondering as I generally try to avoid using Reflection at all costs.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
