devxlogo

A Quick Way to Generate Properties in Visual Studio C# Projects

A Quick Way to Generate Properties in Visual Studio C# Projects

When building classes in Visual Studio (VS), you can generate property setters and getters quickly by defining a field variable, and then right-clicking on the field and selecting Refactor ? Encapsulate Field from the popup menu. VS will display a dialog that lets you approve/change the property name, and optionally, preview changes. When you’re satisfied, simply click OK. Voilà! VS generates the property!

devx-admin

Share the Post: