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

📄 class1.cs

📁 C#开发教程 由浅入深 配有实例 是初学者的好帮手
💻 CS
字号:
using System;
using System.Reflection;

public class Apple 
{
	public int nSeeds;
	public void Ripen() 
	{
	}
}

public class TypeOfApp
{
	[STAThread]
	static void Main(string[] args)
	{
		// Retrieve the System.Type object from the class definition.
		Type t = typeof(Apple);
		string className = t.ToString();

		Console.WriteLine("\nInformation on the class {0}", 
			className);
	    
		Console.WriteLine("\n{0} methods", className);
		Console.WriteLine("-----------------------------");
		MethodInfo[] methods = t.GetMethods();
		foreach (MethodInfo method in methods) 
		{
			Console.WriteLine(method.ToString());
		}

		Console.WriteLine("\nAll {0} members", className);
		Console.WriteLine("-----------------------------");
		MemberInfo[] allMembers = t.GetMembers();
		foreach (MemberInfo member in allMembers) 
		{
			Console.WriteLine(member.ToString());
		}      

		// Retrieve the System.Type object from the object.
		Apple apple = new Apple();
		Type t2 = apple.GetType();   
	}
}



⌨️ 快捷键说明

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