KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Class c = new Class( { Prop = "Initial" } ); I have the class above. How would you create a method to modify it? public Class ModifyIt(Class c) { c.Prop = "changed"; return c; } or public void ModifyIt(Class c) { c.Prop = "changed"; } Then called like this... Class c = ModifyIt(c); Console.WriteLine(c.Prop); // changed or this ModifyIt(c) Console.WriteLine(c.Prop); // changed Whats your preference?
Tags (comma-separated)
Save Edits
Cancel