The CopyCmd
property in the question is an auto-implemented property. It is equivalent to this code:
private ICommand _CopyCmd;
public ICommand CopyCmd {
get { return CopyCmd;}
set { _CopyCmd = value; }
}
In fact, the only difference between the above and what the compiler really does is the actual produced IL uses a different name than _CopyCmd
which is not legal for C#, such that you can't accidently create a name in your own code which will conflict with the backing field.
The FullName
property, though, does more work in the set
block. You can do anything in a set
block, but as soon you do more than assign the value to a backing field you can't use an auto-implemented property anymore.
In this case, the code also calls the SetProperty()
method, which matches a convention typically associated with INotifyPropertyChanged
. This makes it easy to have an event you can subscribe to which is raised any time this property changes.