[Csharp] using System; using System. collections. generic; using System. linq; using System. text; namespace ConsoleApplication1 {class Program {static void Main (string [] args) {Console. writeLine ("direct new Parent class"); Parent p = new Parent (); p. print (); Console. writeLine ("new subclass"); Sub s = new Sub (); s. print (); Console. writeLine ("Parent class new subclass"); Parent p2 = new Sub (); p2.Print (); Console. read () ;}} public Class Parent {public void Print () {Console. WriteLine ("1st types: Random strain. The child is the Child Parent and the Parent. Obtain the type "); Type t1 = this. getType (); Console. writeLine (t1.FullName); Console. writeLine ("2nd: it must be a parent class. obtain the type ") of the class where the execution method is located; Type t2 = new System. diagnostics. stackTrace (). getFrame (0 ). getMethod (). declaringType; Console. writeLine (t2.FullName); Console. writeLine ("3rd: it must be a parent class. obtain the type of the class object where the execution method is located.); Type t3 = System. reflection. methodBase. getCurrentMethod (). reflectedType; Console. writeLine (t3.FullName); Console. writeLine ("4th: it must be a parent class. obtain the type "); Type t4 = System. reflection. methodBase. getCurrentMethod (). declaringType; Console. writeLine (t3.FullName); Console. writeLine () ;}} public class Sub: Parent {}}