The Lounge is rated PG. If you're about to post something you wouldn't want your
kid sister to read then don't post it. No flame wars, no abusive conduct, no programming
questions and please don't post ads.
Thank you for this.
A first Trial from my side; I suggest you to download the source and try to build the Project. For me it ends in 13 Errors. Several times "PropertyChanged?.Invoke ..." and others (VS 2012 Express).
I am using some C#... err.., 5? 6? 4? (kind of confused) functionality.
The nullable invocation parameter a?.b
I am also using CallerMemberNameAttribute which came with .NET 4.5 I think, and reduce many errors....
(hence I want to show that I use it as a good tip for people to follow!)
All of that to say it work for me, but I am using VS2015 and the latest version of C#....
mm... not to sure how to go about that... VS2015 is free after all!
IMHO, you should use compiler directives and include code for the various versions of DotNet when calling NotifyPropertyChanged is concerned, or at least put a note in the article that describes the changes that are required if you use something older than .Net 5...
".45 ACP - because shooting twice is just silly" - JSOP, 2010 - You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 - When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
I am trying to write the most simplistic MVVM sample that can be written and explained.
It just so happen that C# 6 + .NET4.5 added some feature which do help write simpler code.
Getting bog down into perfecting the implementation or explaining the fine difference between C# 1,2,3,4,5,6, WinForm, WPF, XAML, .NET3, .NET4, .NET4.5, .NET4.6 is completely out of scope for my article!
Now I can understand that if you don't know the null coalesce article from C# 6 (a?.b) you could be paralysed by fear or doubt!
After all complaints I decided to add an introductory warning about the requirements, as well as a link to this C# 6 syntax feature: Null-conditional Operators (C# and Visual Basic)[^] (pending moderator approval)
This is as far as I will go into being diverted from my goal of simplistic sample.
Oh my, you made such progress with C# 6 in such a short time!
And you are right, your C# 6 link is better and more instructive!
(but I already have a link to ObservableCollection)
That will be the last changes before bed!
I did abstain to use nameof to avoid confusing people! but clearly it was not enough!
This is good timing as I've recently been learning this pattern whilst using Telerik's Kendo UI components that implement MVVM
"There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult." - C.A.R. Hoare