methodinfo Questions

2

Solved

Right now, I have: targetType.GetMethod("get_Item", BindingFlags.Instance) Is there anything better?
Worldshaking asked 10/2, 2011 at 0:18

1

With continutation to my earlier thread Using reflection read properties of an object containing array of another object. I am hoping to make this wonderful method from EvgK a generic method that c...
Laparotomy asked 7/2, 2011 at 16:55

4

Solved

I have a MethodInfo of a GenericMethodDefinition. Such as: CallMethod<T>(T arg, string arg2). The GetParameters() method will give me two ParameterInfo objects, the first of which is generic,...
Mika asked 19/1, 2011 at 17:56

2

Solved

How do I call SomeObject.SomeGenericInstanceMethod<T>(T arg) ? There are a few posts about calling generic methods, but not quite like this one. The problem is that the method argument param...
Marsha asked 19/1, 2011 at 17:4

3

Solved

After googling and landing on SO and having read this other question Is it possible to build a correct Delegate from a MethodInfo if you didn't know the number or types of parameters at compile ...
Fairhaired asked 14/7, 2009 at 10:28

1

Solved

Whats the easiest way to traverse a methodinfo in c#? I want to traverse the method body and find field-references and such and retrieves the types. In System.Reflection there is: mi.GetMethodBo...
Trigraph asked 5/8, 2010 at 10:22

2

Solved

Update: I've filed a bug report on Microsoft Connect: https://connect.microsoft.com/VisualStudio/feedback/details/568271/debugger-halting-on-exception-thrown-inside-methodinfo-invoke#details If yo...
Masakomasan asked 16/6, 2010 at 23:6

6

Solved

I realize that, generally speaking, there are performance implications of using reflection. (I myself am not a fan of reflection at all, actually; this is a purely academic question.) Suppose ther...
Epilimnion asked 29/5, 2010 at 0:6

2

Solved

I have a class with a bunch of methods. some of these methods are marked by a custom attribute. I would like to call all these methods at once. How would I go about using reflection to find a ...
Medieval asked 14/5, 2010 at 4:19

2

I have a try/catch around a MethodInfo.Invoke(o,null), and VS2010 is set to never break on Exceptions, but unfortunately the debugger continues to break inside the Invoked method. The method is sta...
Dominiquedominium asked 27/4, 2010 at 20:11

1

Solved

How can I determine if a MethodInfo fits a distinct Delegate Type? bool IsMyDelegate(MethodInfo method); Edit: I'm given a MethodInfo object and want to know if it fits the delegate interface. A...
Dafodil asked 8/2, 2010 at 11:3

5

Solved

In .NET, using reflection how can I get class variables that are used in a method? Ex: class A { UltraClass B = new(..); SupaClass C = new(..); void M1() { B.xyz(); // it can be a method ca...
Hymenium asked 16/9, 2009 at 21:7

2

Solved

I have this little problem, that I cannot figure out which arguments to pass to Type.GetMethod in order to get back the MethodInfo of a generic method on a non generic type. Specifically, I h...
Disenthrall asked 26/10, 2009 at 13:33

3

Solved

I have made a custom Attribute here named AAtribute, and for instance a class called B where one or more methods use the attribute. Is it possible to get the MethodInfo of the method that holds the...
Hellenhellene asked 28/8, 2009 at 9:49

3

Solved

I would like to get the name of the method that is being delegated as a Func. Func<MyObject, object> func = x => x.DoSomeMethod(); string name = ExtractMethodName(func); // should equal "...
Fleabag asked 4/8, 2009 at 3:43

5

Solved

As part of my application I have a function that receives a MethodInfo and need to do specific operations on it depending if that method is "Extension Method". I've checked the MethodInfo class an...
Bevan asked 6/4, 2009 at 14:47

© 2022 - 2024 — McMap. All rights reserved.