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}
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}
相关文章推荐
- C#实现如何判断一个数组中是否有重复的元素
- 判断一个字符串是否全是数字的多种方法及其性能比较(C#实现)
- 判断一个字符串是否全是数字的多种方法及其性能比较(C#实现)--来源CSDN
- (转)判断一个字符串是否全是数字的多种方法及其性能比较(C#实现
- C#实现判断一个时间点是否位于给定时间区间的方法
- 判断一个字符串是否全是数字的多种方法及其性能比较(C#实现)
- 判断一个字符串是否全是数字的多种方法及其性能比较(C#实现)
- 判断一个字符串是否全是数字的多种方法及其性能比较(C#实现)
- C#实现如何判断一个字符串是否为整数和浮点
- C#控制台基础 判断一个类是否实现了指定的接口 IsAssignableFrom
- 判断一个点是否在多边形内部,射线法思路,C#实现
- 判断一个字符串是否全是数字的多种方法及其性能比较(C#实现)
- C#实现判断一个IP是否是指定范围内的IP
- c# 如何判断一个类是否实现了某个接口
- 在进行C#编程时候,有的时候我们需要判断一个字符串是否是数字字符串,我们可以通过以下两种方法来实现。 【方法一】:使用 try{} catch{} 语句。 我们可以在try语句块中试图
- c# 如何判断一个类是否实现了某个接口
- 判断一个字符串是否全是数字的多种方法及其性能比较(C#实现)
- C#判断一个类是否实现了某个接口3种实现方法
- C# 如何判断一个类是否实现了某个接口
- 判断一个对象是否实现了某方法,而非继承而来