In ReSharper 9, how to generate autoproperties from missing members?

In ReSharper 8, when there were no interface members (properties) in the class, I would press Alt + Enter and select "Implement Missing Members", which will generate auto processes as follows:

public class MyClass : IHasId { public int Id { get; set; } } 

However, the following is generated in ReSharper 9:

 public class MyClass : IHasId { public int Id { get { throw new System.NotImplementedException(); } set { throw new System.NotImplementedException(); } } } 

I installed R # to create automatic properties in the "Member Generation" section, still no effect.

Is this a mistake, or am I missing something?

+6
source share
1 answer

There seem to be some weird options here that affect each other.

Do it:

Go inside the class (i.e. not the squigglies of the class or interface) and press Alt + Insert to generate the code, then select "Missing Members".

In the dialog that appears, change the parameter below to create automatic properties:

ReSharper 9: Implement missing members

Then open this dialog box, note that I did not select any elements for implementation. Then try Alt + Enter again on the class / interface.

This seems strange, to say the least, but now, at least you can “fix” it.

+7
source

Source: https://habr.com/ru/post/980697/


All Articles