About 12,500,000 results
Open links in new tab
  1. 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 …

  2. Change private static final field using Java reflection

    Jul 21, 2010 · I have a class with a private static final field that, unfortunately, I need to change it at run-time. Using reflection I get this error: java.lang.IllegalAccessException: Can not set …

  3. 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: …

  4. java - What is reflection and why is it useful? - Stack Overflow

    Sep 1, 2008 · What is reflection, and why is it useful? I'm particularly interested in Java, but I assume the principles are the same in any language.

  5. 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 …

  6. reflection - Loading DLLs at runtime in C# - Stack Overflow

    I am trying to figure out how you could go about importing and using a .dll at runtime inside a C# application. Using Assembly.LoadFile() I have managed to get my program to load the dll (this …

  7. How do I call a generic method using a Type variable?

    The compiler generates code that at runtime checks the real types of passed arguments (by using reflection) and choose the best method to call. Here there is only this one generic method, so …

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

    Apr 10, 2009 · You can use Reflection to do this: (from my library - this gets the names and values) public static Dictionary<string, object> DictionaryFromType(object atype)

  9. C# Reflection: How to get the type of a Nullable<int>?

    Dec 18, 2011 · If you're suggesting to create several functions with different parameter types, I could. In this case, I am copying a set of properties of different types from one object to …

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

    the dynamic internally uses reflection. You could use reflection directly to get the Quack method and call it Case 5: as case 4, but using directly reflection: object objFoo = MakeFoo(); // object …