Complete the code to get the type of the object.
Type type = obj.[1]();The GetType() method returns the runtime type of the current instance.
Complete the code to get the name of the class using reflection.
string className = obj.GetType().[1];The Name property of the Type object returns the class name without namespace.
Fix the error in the code to get all public properties of a class.
PropertyInfo[] properties = obj.GetType().[1]();GetProperties() returns all public properties of the type, which is needed to inspect properties via reflection.
Fill both blanks to invoke a method named 'Print' with no parameters using reflection.
MethodInfo method = obj.GetType().[1]("Print"); method.[2](obj, null);
GetMethod("Print") gets the method info, and Invoke(obj, null) calls it on the object with no parameters.
Fill all three blanks to create an instance of a class named 'Person' using reflection.
Type type = Type.[1]("Person"); object obj = Activator.[2](type); string name = (string)type.GetProperty("Name").[3](obj);
Type.GetType("Person") gets the type, Activator.CreateInstance(type) creates an object, and GetValue(obj) gets the property value.