Passing properties by reference in C#
Properties cannot be passed by reference. Here are a few ways you can work around this limitation. 1. Return Value string GetString(string input, string output) { if (!string.IsNullOrEmpty(input)) { return input; } return output; } void Main() { var person = new Person(); person.Name = GetString(“test”, person.Name); Debug.Assert(person.Name == “test”); } 2. Delegate void GetString(string … Read more