About 2,900,000 results
Open links in new tab
  1. c# - Set object property using reflection - Stack Overflow

    Is there a way in C# where I can use reflection to set an object property? Ex: MyObject obj = new MyObject(); obj.Name = "Value"; I want to set obj.Name with reflection. Something like: …

  2. How do I use reflection to invoke a private method?

    Reflection is slow. Private members reflection breaks encapsulation principle and thus exposing your code to the following : Increase complexity of your code because it has to handle the …

  3. reflection - Cast to a reflected Type in C# - Stack Overflow

    Foo result = (Foo)objFoo; There's no real point in casting an object to a type that's unknown at compile time - you won't be able to use it: object objFoo = MakeFoo(); UnkownType result = …

  4. How to dynamically create generic C# object using reflection?

    Oct 3, 2015 · I want to dynamically create TaskA or TaskB using C# reflection (Activator.CreateInstance). However I wouldn't know the type before hand, so I need to …

  5. c# - Getting Enum value via reflection - Stack Overflow

    Nov 27, 2012 · I have a simple Enum public enum TestEnum { TestOne = 3, TestTwo = 4 } var testing = TestEnum.TestOne; And I want to retrieve its value (3) via reflection. Any ideas on …

  6. reflection - How do I invoke a Java method when given the …

    Use method invocation from reflection: Class<?> c = Class.forName("class name"); Method method = c.getDeclaredMethod("method name", parameterTypes); …

  7. c# - Using reflection to get values from properties from a list of a ...

    May 23, 2012 · Using reflection to get values from properties from a list of a class Asked 13 years, 1 month ago Modified 12 years, 8 months ago Viewed 69k times

  8. Reflection: How to Invoke Method with parameters - Stack Overflow

    I am trying to invoke a method via reflection with parameters and I get: object does not match target type If I invoke a method without parameters, it works fine. Based on the following code …

  9. Get property value from string using reflection - Stack Overflow

    I am trying implement the Data transformation using Reflection 1 example in my code. The GetSourceValue function has a switch comparing various types, but I want to remove these …

  10. How to get the list of properties of a class? - Stack Overflow

    Apr 10, 2009 · Following feedback... To get the value of static properties, pass null as the first argument to GetValue To look at non-public properties, use (for example) …