Answers for "what is reflection in programming"

C#
0

what is reflection in programming

//Ability to access objects fields/methods (also if they are private)
// in run time (read more about the subjects pro`s and con`s before impl)

// Without reflection
Foo foo = new Foo();
foo.PrintHello();

// With reflection
Object foo = Activator.CreateInstance("complete.classpath.and.Foo");
MethodInfo method = foo.GetType().GetMethod("PrintHello");
method.Invoke(foo, null);
Posted by: Guest on February-26-2022

Code answers related to "what is reflection in programming"

C# Answers by Framework

Browse Popular Code Answers by Language