class MyBaseClass { class MyNestedClass { String _MyVariable; public String MyVariable { get { return _MyVariable; } set { _MyVariable = value; } } } //This one valid void MyMethod() { MyNestedClass objMyClass = new MyNestedClass(); objMyClass.MyVariable = ""; } //This also valid MyNestedClass objMyClass = new MyNestedClass() { MyVariable = "Some Value" }; //Everyone know, The Below commented code raise the following error, when it will be uncommented. //Invalid token 'void' in class, struct, or interface member declaration //objMyClass.MyVariable = "Some Value"; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)