5 comments

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?)

0
Avatar
Permanently deleted user

hmm, they introduced that feature 2 weeks ago :)

http://blogs.jetbrains.com/dotnet/2012/07/resharper-7-whats-inside/

0

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
0

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
0
Avatar
Permanently deleted user

Ok thx, it works now :)

0

Please sign in to leave a comment.