I was surprised to learn that the "ref" and "out" parameters are not marked with a special attribute, despite the existence of ParameterInfo.IsOut, ParameterInfo.IsIn (both of which are always false, as far as I can see), ParameterAttributes.In and ParameterAttributes.Out. Instead, the "ref" parameters are actually represented by the special type of the "Type" object, and the "outputs" are simply ref parameters with an additional attribute (which attribute I don't know yet).
In any case, to make the by-ref argument, you call Type.MakeByRefType (), but my question is, if you already have a by-ref type, how will you return to the original type?
Hint: this is not UnderlyingSystemType:
Type t = typeof(int);
Console.WriteLine(t.MakeByRefType().UnderlyingSystemType==t);
source
share