Hello,
I am using reflections to get Parameters and their types of a COM Interop
Assembly method. ParameterType.FullName returns "System.Boolean&" what's the
significance of & at the end?
Here's my code:
/* Project1.Class1Class has 1 method doA, second param is boolean type */
//Get Type from Assebly
Assembly asm = Assembly.Load("Interop.Project1");
//Create Type instance
Type asmT = asm.GetType("Project1.Class1Class");
//get Method Info and Parameter info
MethodInfo mInfo = asmT.GetMethod("doA");
ParameterInfo[] paramsInfo = mInfo.GetParameters();
//display type full name
MessageBox.Show(paramsInfo[1].ParameterType.FullName);
Mattias Sjögren - 16 Dec 2005 20:27 GMT
>I am using reflections to get Parameters and their types of a COM Interop
>Assembly method. ParameterType.FullName returns "System.Boolean&" what's the
>significance of & at the end?
It indicates that it's a byref parameter (like if you use the ref or
out modifiers in C#). paramsInfo[1].ParameterType.IsByRef should be
true.
Mattias

Signature
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
rossum - 17 Dec 2005 14:45 GMT
>Hello,
>
>I am using reflections to get Parameters and their types of a COM Interop
>Assembly method. ParameterType.FullName returns "System.Boolean&" what's the
>significance of & at the end?
The COM Interop Assembly may have been written in C++. In C++ an "&"
at the end of a method parameter indicates a reference parameter. In
C# this would be "ref System.Boolean".
rossum
--
The ultimate truth is that there is no ultimate truth