Useful Snippets for Visual Studio - C#
Creates prop with backing field, also rising property changed event. Example:
private string customerFirstName;
public string CustomerFirstName
{
get => this.customerFirstName;
set => this.Set(ref this.customerFirstName, value);
}Creates ICommand prop with backing field. Example:
private IMvvmCommand nextPageCommand;
public IMvvmCommand NextPageCommand => this.nextPageCommand ?? (this.nextPageCommand = new ActionCommand(() => { }));Creates prop with backing field, also rising property changed event. Example:
private string customerFirstName;
public string CustomerFirstName
{
get => this.customerFirstName;
set => this.SetProperty(ref this.customerFirstName, value);
}Creates ICommand prop with backing field. Example:
private ICommand nextPageCommand;
public ICommand NextPageCommand => this.nextPageCommand ?? (this.nextPageCommand = new DelegateCommand(() => { }));