Wednesday, December 16, 2015

Class Widget: Convert Methods to Property


Its feature is pretty self-explanatory, creating properties from methods.

If something like the following is written anywhere in a class,

private string name;

public string GetName()
{
return name;
}
public void SetName(string value)
{
name = value;
}

         the two methods are selected, and the Create Methods From Property command is called up, the following code will be created and maintained:

private string name;
public string Name
{
get
{
return name;
}
set
{
name = value;
}
}

The code compiles right away. Enjoy!

No comments:

Post a Comment