Is it possible to iterate through public properties of a class to create a public const string of the Property name.

I can a lot of POCO classes, each with a number of public properties.  What I would like to do is to find all the public property names, and create a public const string of the filed names.  For example:

public class  Class1
{

    public int Id {get; set;}

    public string Name {gets; set;}

    public const string IdField = "Id";        --------  Create this with a script or something

    public const string NameField = "Name";      --------  Create this with a script or something

}

0
1 comment

Hello Mark!

 

Thank you for contacting us.

There's no such option in ReSharper. I'd suggest trying ReSharper Live Template macros, they can be used while creating code - https://www.jetbrains.com/help/resharper/Templates__Template_Basics__Template_Macros.html

Thank you.

0

Please sign in to leave a comment.