tag:blogger.com,1999:blog-5359546512544809971.post6078851635274979833..comments2024-03-22T10:42:37.237-07:00Comments on Jeremy Bytes: CallerMemberName vs. nameof() in INotifyPropertyChangedJeremyhttp://www.blogger.com/profile/06749690234470413216noreply@blogger.comBlogger6125tag:blogger.com,1999:blog-5359546512544809971.post-71765709078937230982019-07-03T01:41:03.712-07:002019-07-03T01:41:03.712-07:00Great article. Thanks for sharing.
Great article. Thanks for sharing.<br />Anonymoushttps://www.blogger.com/profile/09031239869836161546noreply@blogger.comtag:blogger.com,1999:blog-5359546512544809971.post-1230815717609359252017-09-14T11:09:03.711-07:002017-09-14T11:09:03.711-07:00Hi Derrick. I have a love/hate relationship with c...Hi Derrick. I have a love/hate relationship with code injectors. They do some pretty cool stuff, but then debugging gets more "interesting" since the code doesn't match the IL. At some point, I'll just have to get over it and move on. Thanks for the tip; it looks pretty cool. INotifyPropertyChanged is one of those things that should be automatic anyway.<br />-JeremyJeremyhttps://www.blogger.com/profile/06749690234470413216noreply@blogger.comtag:blogger.com,1999:blog-5359546512544809971.post-64046760898123293012017-09-13T08:31:53.853-07:002017-09-13T08:31:53.853-07:00Hi, Jeremy. Have you looked into https://github.co...Hi, Jeremy. Have you looked into https://github.com/Fody/PropertyChanged? It will save you from these problems almost entirely.It's pretty slick!<br /><br />BTW - I had the fortune of attending some of your talks at CodeStock this year. They were great!Anonymoushttps://www.blogger.com/profile/12903278228081238577noreply@blogger.comtag:blogger.com,1999:blog-5359546512544809971.post-63790563241243058372017-07-31T07:56:05.597-07:002017-07-31T07:56:05.597-07:00'This means that if we type "FirstName&qu...'This means that if we type "FirstName" incorrectly, we will get a compiler error.'<br /><br />That depends on how we typed it incorrectly.<br />Is there anything we can do to ensure we're not accidentally using `nameof(firstName)` and notifying for the field rather than the property `nameof(FirstName)`?Randyhttps://www.blogger.com/profile/17739096700222049881noreply@blogger.comtag:blogger.com,1999:blog-5359546512544809971.post-42960279105653729222016-02-18T08:37:47.922-08:002016-02-18T08:37:47.922-08:00Hi Joseph. In my code, I've been using the opt...Hi Joseph. In my code, I've been using the optional parameter since default parameters were available. Previously, I would pass the explicit "null" to signify that all properties should be re-bound, but I found that having the default as "null" worked well (I don't remember where I picked up this pattern from; I didn't come up with it myself). This easily was understandable before "CallerMemberName" came along.<br /><br />According to the PropertyChanged documentation, either "null" or "String.Empty" can be used to indicate that all properties have changed. I've been using "null" in my code. I haven't considered removing the parameter default, but it's something worth considering.Jeremyhttps://www.blogger.com/profile/06749690234470413216noreply@blogger.comtag:blogger.com,1999:blog-5359546512544809971.post-29483718639975405622016-02-16T05:05:13.194-08:002016-02-16T05:05:13.194-08:00In fact, if `CallerMemberName` is gone, it's e...In fact, if `CallerMemberName` is gone, it's even better to not allow the parameter to be optional. That way, you don't forget what's going on and it's very explicit and easy to process when you really mean `RaisePropertyChanged(string.Empty)` (binding lingo for "all properties changed").jnm2https://www.blogger.com/profile/04926055076730802189noreply@blogger.com