Does passing a value type in an “out” parameter cause the variable to be boxed?
问题 I'm aware that boxing and unboxing are relatively expensive in terms of performance. What I'm wondering is: Does passing a value type to a method's out parameter cause boxing/unboxing of the variable (and thus a performance hit)? Can the compiler optimize this away? int number; bool result = Int32.TryParse(value, out number); 回答1: As others have pointed out, there's no boxing here. When you pass a variable as an argument corresponding to an out or ref parameter, what you are doing is making