您的位置:首页 > 编程语言 > C#

C#中判断一个类是否实现了某interface

2008-01-03 21:55 337 查看
1using System;

2using System.Threading;

3using System.Text;

4using System.Net;

5using System.Net.Sockets;

6using System.IO;

7using System.Data;

8using System.Collections;

9using System.Collections.Specialized;

10using System.Data.Odbc;

11using System.Text.RegularExpressions;

12

13

14public interface IOne

15

19public interface ITwo

20

24public class One : IOne

25

32public class OneTwo : IOne, ITwo

33

45public class Ware

46{

47static void Main(String[] args) {

48 One oo = new One();

49 OneTwo ot = new OneTwo();

50 Console.WriteLine(oo is IOne);

51 Console.WriteLine(oo is ITwo);

52

53 Console.WriteLine(ot is IOne);

54 Console.WriteLine(ot is ITwo);

55}

56

57

58}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐