471,354 Members | 1,181 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,354 software developers and data experts.

ParameterType.FullName returns "System.Boolean&" explain why

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);
Dec 16 '05 #1
2 3853
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

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Dec 16 '05 #2
On Fri, 16 Dec 2005 11:52:02 -0800, "Lenn"
<Le**@discussions.microsoft.com> wrote:
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
Dec 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by barney | last post: by
5 posts views Thread by martin | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.