473,698 Members | 2,047 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Invoking Method using Reflection

I'm using reflection to invoke some methods,
now the general patteren of the function defination is

private void FunctionName( argument1 , argument2)

for some functions i don't need the argument2 but for some i do...is there
any way using reflection to invoke the method but omit the last argument in
some function definations while for other we use it.
regards,
Beenish Khan
Nov 17 '05 #1
1 2362
Hi,

Are the parameters the same type? I mean is argument1 always the same type
?

When you say that you do not need the second parameter, are you saying that
the method does not require it?
or that you know that the result will be the same no matter what value you
use? if so you should create an overload method ( in case you have access to
the code )
Remember that you have to pass a value to each parameter so even if you do
not use it you need to pass something.

You cannot omit a method, you have to supply a value for each parameter.
cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Beenish Sahar Khan" <be**********@k olachi.net> wrote in message
news:ue******** ********@TK2MSF TNGP12.phx.gbl. ..
I'm using reflection to invoke some methods,
now the general patteren of the function defination is

private void FunctionName( argument1 , argument2)

for some functions i don't need the argument2 but for some i do...is there
any way using reflection to invoke the method but omit the last argument
in some function definations while for other we use it.
regards,
Beenish Khan

Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
323
by: djp | last post by:
Hi, I'm trying to access fields that are local to a method using reflection. What BindingFlags value should I use and is this possible at all. So far I was able to retreive class fields only. Thanks
1
1273
by: djp | last post by:
Hi, I'm trying to access fields that are local to a method using reflection. What BindingFlags value should I use and is this possible at all. So far I was able to retreive class fields only. Thanks
2
2158
by: Rob | last post by:
I'm using reflection to inspect a class and its methods. Is is possible to determine if the class is a derived class or an interface implementation? I'm using the MethodInfo object for relfection that I use for acquiring the function names, scope, parameters, etc. Is there an "InheritedClassType" or "InterfaceType" property that I can query? I've tried using DeclaringType.BaseType, but that doesn't seem to give me what I want. ...
2
7766
by: Jeff | last post by:
I am trying to dynamically load an assembly via reflection and then invoke a method of that assembly that will populate a custom type collection passed into the method byref. I am able to dynamically load both the DALC component (for the method call) and the Entity component (for the custom type collection to pass in), but I keep getting an error ( Message "Object type cannot be converted to target type.") when invoking the method. If I...
3
6562
by: cartoper | last post by:
I am currently doing some R&D. The objective is to learn how to invoke methods via reflection using the InvokeMember method. The InvokeMember method throws an exception: Method 'ReflectionTest.Originator.AddToA' not found. Here is the code: using System; using System.Diagnostics;
3
1627
by: Rotsey | last post by:
Hi, I am getting a Exception has been thrown by the target of an invocation error when invoking a method Here is the crux of the code. I realise it could be a few things, any one give me an idea where to start looking.
0
1427
by: pso19 | last post by:
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: Dim assemblyToLoad As Assembly = Nothing assemblyToLoad = Assembly.LoadFrom(AssemblyName)
4
6811
by: =?Utf-8?B?QWJoaQ==?= | last post by:
I am using Reflection to invoke methods dynamically. I have got a special requirement where I need to pass a value to method by setting the custom method attribute. As I cannot change the signature of method to pass a new parameter, I am setting the custom attribute of a given method and then accessing the attribute from method. Since attribute value is decided at runtime I want to change the attribute of particular method at runtime....
1
7171
by: Andrus | last post by:
How to call extension method using reflection ? I tried this code but methodInfo is null. Andrus. using System.Reflection; using System.Windows.Forms;
0
8603
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9026
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8893
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8861
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3045
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2328
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.