⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sample20.cs

📁 C#函数手册
💻 CS
字号:
namespace apiBook
{
	using System;
	using System.Net.Sockets;
	using System.IO;
	using System.Reflection;
	public class TestClass
	{
		public static void Main()
		{
			TcpClient tcp=new TcpClient();
			Type testType=tcp.GetType();
			Console.WriteLine("tcp.GetType()="+testType.ToString());			
			TypeFilter testFilter = new TypeFilter(TestInterfaceFilter);
			String[] testInterfaceList = 
				new String[2] {"System.IDisposable","System.IFormattable"};
			for(int i=0; i < testInterfaceList.Length; i++)
			{
				Type[] testInterfaces = testType.FindInterfaces(testFilter, testInterfaceList[i]);            
				if (testInterfaces.Length > 0) 
				{
					Console.WriteLine("类"+testType+" 实现了" +testInterfaceList[i]+"接口" );   
					for(int j =0;j < testInterfaces.Length;j++)
					{
						Console.WriteLine("支持的接口为:  #"+ j +": "+testInterfaces[j].ToString());
					}
				}
				else
				{
					Console.WriteLine();
					Console.WriteLine("类"+testType+"没有实现"+testInterfaceList[i]+"接口");   
				}
			}
			Console.ReadLine();			
		}
		public static bool TestInterfaceFilter(Type typeObj,Object obj)
		{
			if(typeObj.ToString() == obj.ToString())
				return true;
			else
				return false;
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -