Reflection - method parameter marked as "out" doesn't have a BaseType

  • Thread starter Thread starter timnels
  • Start date Start date
T

timnels

I've got some code that is trolling through and assembly looking for
methods that have parameters whose BaseType is DataSet (they are
strongly-typed DataSets). .ParameterType.BaseType is always DataSet
for parameters that are passed like:

MyMethod(MyStronglyTypedDataSet myDataSet);

.... but the BaseType is null for :

MyMethod(out MyStronglyTypedDataSet myDataSet);

Does anyone know why this is happening. How can I tell what the
BaseType this parameter is? T
 
I've got some code that is trolling through and assembly looking for
methods that have parameters whose BaseType is DataSet (they are
strongly-typed DataSets). .ParameterType.BaseType is always DataSet
for parameters that are passed like:

MyMethod(MyStronglyTypedDataSet myDataSet);

... but the BaseType is null for :

MyMethod(out MyStronglyTypedDataSet myDataSet);

Does anyone know why this is happening. How can I tell what the
BaseType this parameter is? T

Use Type.HasElementType/Type.GetElementType() to get the "non-out"
type, and then you can find the base type from that.

Jon
 
Back
Top