Replace all magic string with just one regex

Today I am going to show you how to use a regular expression with back reference matching to quickly replace all occurrences of magic strings to strong type names. In my WPF project I had a method which was connected to the INotifyPropertyChanged interface and notified the WPF binder whenever a property on my model was changed. This method took as a parameter the name of the pr…

By Mirek on (tags: INotifyPropertyChanged, nameof, regex, visual studio, categories: tools)

Making NotifyPropertyChanged refactorable.

Common problem when using INotifyPropertyChanged interface is that the PropertyChangedEventHandler event accept a string property name as a parameter. That cause a possible problem when we want to refactor the property and forget to update the provided property‚Äôs name. There is a plenty of blog threads in the web that tries to solve this problem. The very common solution benefi…

By Mirek on (tags: INotifyPropertyChanged, categories: code)