473,398 Members | 2,120 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

How to create dynamic parameters and pass to invoke a method using reflection

1
Hi,

I am trying to access all the properties, methods of an assembly using reflection. But what i want to do is invoke a method which contains custom parametrs like enumeration defined in a different assembly.

For ex:

Expand|Select|Wrap|Line Numbers
  1.  Dim assemblyToLoad As Assembly = Nothing
  2.  
  3.             assemblyToLoad = Assembly.LoadFrom(AssemblyName)
  4.  
  5.             Dim types As Type() = assemblyToLoad.GetTypes()
  6.             Dim type1 As Type
  7.  
  8.             For Each type1 In types
  9.                 If type1.IsClass And (String.Compare(type1.FullName, ClassName.Trim()) = 0) Then
  10.  
  11.                     Dim mi As MethodInfo() = type1.GetMethods()
  12.                     Dim mi1 As MethodInfo
  13.                     For Each mi1 In mi
  14.                         If mi1.IsStatic Then
  15.  
  16.                             Dim ex As ParameterInfo
  17.  
  18.  
  19.                             For Each ex In CType(mi1, MethodInfo).GetParameters()
  20.  
  21.                                 Dim parameterType As String = ex.ParameterType.ToString()
  22.                                 Dim parameterName As String = ex.Name.ToString()
  23.  
  24. ' After knowing the parameter type to be for ex: NewAssembly.Class.Enum
  25. ' How i pass this type to invoke the methos??
  26.  
  27.                             Next
  28.  
  29.                         End If
  30.  
  31.                     Next
  32.  
  33.                 End If
  34.  
  35.             Next
Oct 5 '07 #1
0 1386

Sign in to post your reply or Sign up for a free account.

Similar topics

16
by: AxlsPixel | last post by:
Hi All, I have a class (called CTestClass) within which I have a method (Foo). This method has the following signature: Foo(int x, int y, ref int z) I am attempting to use reflection to...
2
by: Robert May | last post by:
We have a VB6 COM component that I don't have control over. All of the values are returned from method calls using byref parameters. They frequently break binary compatibility, in fact, there are...
3
by: Stephen Gennard | last post by:
Hello, I having a problem dynamically invoking a static method that takes a reference to a SByte*. If I do it directly it works just fine. Anyone any ideas why? I have include a example...
10
by: Yechezkal Gutfreund | last post by:
I have two subclasses of SpriteModel (1) LocalSprite (2)Sprite Both implement a method called .ToXml() which returns an XmlDocument. But they are different. I instances of these objects...
5
by: Brad | last post by:
All samples related to this see to come short of being 'truly' dynamic. For instance, after creating all the code to load/save a properties value, you turn around and save it to one you KNOW...
12
by: Gus | last post by:
Hi, I´m triying to invoke a member using reflection, but this member requiere two parameters, the first patrameter is a string and the second is a reference to a dataset (output parameter). The...
9
by: Kishor | last post by:
Hi all, I am Using VB.Net for developing my application. I am now needed help. In this project I have to execute some function, but I cannot call them directly using function name, I wanted to...
1
by: ian | last post by:
Hi, I can't find a solution to this, so I've brought it to the experts. Using reflection I can get a MethodInfo object pointing at an assembly's method. Where I have a MethodInfo object...
13
by: DaTurk | last post by:
Hi, This is a question brought about by a solution I came up with to another question I had, which was "Dynamic object creation". So, I'm curious if you can dynamically cast an object. If you...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.