Guest User

Untitled

a guest
Sep 21st, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1.  
  2. class Program
  3. {
  4. static void Main(string[] args)
  5. {
  6. var source = new MyType();
  7.  
  8. source.IsTypeOf(MyType.Type); //例子
  9. MyType.IsMyType(source); //IsMyType比较合适点
  10. //MyType.IsTypeOf(source); //看起来比较奇怪啊
  11. }
  12. }
  13. public static class TypeExtention
  14. {
  15. public static bool IsTypeOf(this object source, Type target)
  16. {
  17. return true;
  18. }
  19. }
  20. public class MyType
  21. {
  22. public static Type Type
  23. {
  24. get { return typeof(MyType); }
  25. }
  26. public static bool IsMyType(object type)
  27. {
  28. return true;
  29. }
  30. }
Add Comment
Please, Sign In to add comment