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

📄 reflect.cs

📁 c#的学习资料 书上的东西 很难找到的啊
💻 CS
字号:
// Reflect.cs -- Uses reflection to show the inherited members of a class.
//
//               Compile this program with the following command line:
//                   C:>csc Reflect.cs
//
using System;
using System.Reflection;

namespace nsReflect
{
    class clsReflection
    {
        private double pi = 3.14159;
        public double Pi
        {
            get {return (pi);}
        }
        public string ShowPi ()
        {
            return ("Pi = " + pi);
        }
    }
    class clsMain
    {
        static public void Main ()
        {
            clsReflection refl = new clsReflection ();
            Type t = refl.GetType();
            Console.WriteLine ("The type of t is " + t.ToString());
            MemberInfo [] members = t.GetMembers();
            Console.WriteLine ("The members of t are:");
            foreach (MemberInfo m in members)
                Console.WriteLine ("   " + m);
        }
    }
}

⌨️ 快捷键说明

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