Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Program
- {
- static void Main(string[] args)
- {
- var source = new MyType();
- source.IsTypeOf(MyType.Type); //例子
- MyType.IsMyType(source); //IsMyType比较合适点
- //MyType.IsTypeOf(source); //看起来比较奇怪啊
- }
- }
- public static class TypeExtention
- {
- public static bool IsTypeOf(this object source, Type target)
- {
- return true;
- }
- }
- public class MyType
- {
- public static Type Type
- {
- get { return typeof(MyType); }
- }
- public static bool IsMyType(object type)
- {
- return true;
- }
- }
Add Comment
Please, Sign In to add comment