KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have the following property public MyType MyProperty {get;set;} I want to change this property so that if the value is null, it'll populate the value first, and then return it... but without using a private member variable. For instance, if I was doing this: public MyType MyProperty { get { if (_myProperty != null) return _myProperty else _myProperty = XYZ; return _myProperty; } set { _myProperty = value; } } is this possible? Or do I need the member variable to get it done?
Tags (comma-separated)
Save Edits
Cancel