INotifyPropertyChanged Support in ReSharper 7
I read your blog post ( http://blogs.jetbrains.com/dotnet/2012/07/inotifypropertychanged-support-in-resharper-7/ ) and can't get INotifyPropertyChanged Support :(
I installed latest version of R# 7 EAP (23 Jul 2012)
this is what i get :
https://skydrive.live.com/?cid=B856D22EB45B674C&id=B856D22EB45B674C!311
https://skydrive.live.com/?cid=B856D22EB45B674C&id=B856D22EB45B674C!310
Please sign in to leave a comment.
It is possible it was added to the code but has not yet been released. As you can see todays build is missing perhaps it is available in the next build (tomorow?)
hmm, they introduced that feature 2 weeks ago :)
http://blogs.jetbrains.com/dotnet/2012/07/resharper-7-whats-inside/
Hello,
If you type:
namespace ReSh7Test
{
using System.ComponentModel;
public class Person : INotifyPropertyChanged
{
}
}
Do you have the appropriate 'Implement INotifyPropertyChanged' here?
Attachment(s):
screen304.png
OK, let me explain this in more detail. You need to have JetBrains.Annotations referenced to project where you'd like to recieve INPC support. They are located in 'C:\Program Files (x86)\JetBrains\ReSharper\v7.0\Bin\JetBrains.Annotations.dll' by default.
After that, applying the Context Action 'Implement INotifyPropertyChanged' will insert source code like this:
using System.ComponentModel;
using JetBrains.Annotations;
class MyClass : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
[NotifyPropertyChangedInvocator]
protected virtual void OnPropertyChanged(string propertyName)
{
PropertyChangedEventHandler handler = PropertyChanged;
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
}
}
After that, you will recieve the corresponding context actions, generate, and other options.
Also, you may copy default implementation of JetBrains.Annotations from the "ReSharper | Options | Code Inspection | Code Annotations" (instead of adding reference as I described) to this project (or even the same file). After that, the Quick Fix will do the same, with [NotifyPropertyChangedInvocator] attribute.
Attachment(s):
screen307.png
Ok thx, it works now :)