Been looking for a way (either built-in, or through a plugin), to automate the properties and defaults when instantiating a class. For example, if I have the following:
public class MyClass
{
string MyPropertyString { get; set; }
int MyPropertyIntWithDefault { get; set; } = 5,
decimal? MyPropertyDecimalWithNoDefault { get; set; }
}
I'd love to be able to say MyClass MyClassImplemented = new MyClass {
, hit a button or click an option, and have it automatically finish my code as:
MyClass MyClassImplemented = new MyClass {
MyPropertyString = "",
MyPropertyIntWithDefault = 5,
MyPropertyDecimalWithNoDefault = null
};
I'm guessing I could write an extension or tool myself using reflection, but if anyone has any suggestions that have already been implemented, I'd love to hear them. Thanks!
* EDIT *
To be clear, what I'm looking for is a way to automate the generation of that stub so that I can then change the ones I want to change, instead of having to either type them in manually or copy-paste them from the definition. I know that I can set default values so that I can generate the class with those values automatically.