Implementing INotifyPropertyChanged - does a better way exist?

前端 未结 30 2616
感情败类
感情败类 2020-11-21 05:23

Microsoft should have implemented something snappy for INotifyPropertyChanged, like in the automatic properties, just specify {get; set; notify;} I

30条回答
  •  执念已碎
    2020-11-21 05:52

    All these answer are very nice.

    My solution is using the code snippets to do the job.

    This uses the simplest call to PropertyChanged event.

    Save this snippet and use it as you use 'fullprop' snippet.

    the location can be found at 'Tools\Code Snippet Manager...' menu at Visual Studio.

    
    
        
            
    inotifypropfull inotifypropfull http://ofirzeitoun.wordpress.com/ Code snippet for property and backing field with notification Ofir Zeitoun Expansion
    type Property type int property Property name MyProperty field The variable backing this property myVar

    You can modify the call as you like (to use the above solutions)

提交回复
热议问题