c#, Internal, and Reflection -


Is there a way to execute the "internal" code through reflection?

Here is an example program:

  using the system; Using the system. Namespace reflection interlude {class program {static zero main (string [] args) {Assembly assembly of ASM =. Gate contingency assembly (); // Call a new test class as usual (); // Call with reflection asm.CreateInstance ("ReflectionInternalTest.TestClass", false, bindings. Default | binding flag; game, pointless, empty, empty, null); // Stop Console.Redline (); }} Class Test Class {Internal Test Class () {Console.WriteLine ("Test Class Instant"); Creating an exam class usually works perfectly, even when I try to make an example through reflection, then I get the wrong method method error, so that the constructor can not be found (which would be  

Is it impossible, or can I do something?

Here's an example ...

  class program {static or oid main (string [] arg) {var tr = typeof (TestReflecti On); var CTR = tr.GetConstructor (bindingfalag nonpolic | bindingflag.instance, blank, new type [0], blank); var obj = ctr.Invoke (tap); (TestReflection obj) .DoThatThang (); Console .ReadLine ();}} Class TestReflection {Internal TestReflection () {} Public Zero DoThatThang () {Console.WriteLine ("Done!")}}  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -