Passing a property as an 'out' parameter in C#
Suppose I have: public class Bob { public int Value { get; set; } } I want to pass the Value member as an out parameter like Int32.TryParse("123", out bob.Value); but I get a compilation error, "'out' argument is not classified as a variable." Is there any way to achieve this, or am I going to have to extract a variable, à la: int value; Int32.TryParse("123", out value); bob.Value = value; You'd have to explicitly use a field and "normal" property instead of an auto-implemented property: public class Bob { private int value; public int Value { get { return value; } set { this.value = value; }