标签:
1 code
1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Reflection; 5 using System.Text; 6 using System.Threading.Tasks; 7 8 namespace ConsoleApplication1 9 { 10 class Program 11 { 12 static void Main(string[] args) 13 { 14 Type tpPerson = typeof(Person); 15 Type tpStudent = typeof(Student); 16 17 //student是person的父类吗? 18 bool res = tpPerson.IsSubclassOf(tpStudent); 19 Console.WriteLine(res); 20 21 //person是student的父类吗? 22 res = tpStudent.IsSubclassOf(tpPerson); 23 Console.WriteLine(res); 24 25 Console.ReadKey(); 26 } 27 } 28 29 public class Person 30 { } 31 public class Student:Person 32 { } 33 }
2 show
标签:
原文地址:http://www.cnblogs.com/jinlingzi/p/5982891.html