<pre id="bbfd9"><del id="bbfd9"><dfn id="bbfd9"></dfn></del></pre>

          <ruby id="bbfd9"></ruby><p id="bbfd9"><mark id="bbfd9"></mark></p>

          <p id="bbfd9"></p>

          <p id="bbfd9"><cite id="bbfd9"></cite></p>

            <th id="bbfd9"><form id="bbfd9"><dl id="bbfd9"></dl></form></th>

            <p id="bbfd9"><cite id="bbfd9"></cite></p><p id="bbfd9"></p>
            <p id="bbfd9"><cite id="bbfd9"><progress id="bbfd9"></progress></cite></p>

            .net學習心得

            時間:2020-12-17 11:00:31 學習心得體會 我要投稿

            .net學習心得

            1.反射:反射是.net中的重要機制,通過反射可以在運行時獲得.net中每一個類型,包括類、結構、委托和枚舉的成員,包括方法、屬性、事件,以及構造函數等。有了反射,既可以對每一個類型了如指掌。

            下面來演示一下反射的實例

            (1)新建一個類庫項目。在解決方案上單擊右鍵選擇添加“新建項目”,在彈出來的框中選擇“類庫”,在下面名字欄中輸入classlib。然后刪除class1類,新添加一個類“classperson”,添加如下代碼:

            namespace classlib
            {
                public class classperson
                {
                    public classperson():this(null)
                    {

                    }
                    public classperson(string strname)
                    {
                        name = strname;
                    }

                    private string name;
                    private string sex;
                    private int age;

                    public string name
                    {
                        get { return name; }
                        set { name = value; }
                    }

                    public string sex
                    {
                        get { return sex; }
                        set { sex = value; }
                    }

                    public int age
                    {
                        get { return age; }
                        set { age = value; }
                    }

                    public void sayhello()
                    {
                        if (null==name)
                            console.writeline("hello world");
                        else
                            console.writeline("hello," + name);  
                    }
                }
            }

            添加完之后編譯生成一下,就會在這個類庫項目中的bin\debug中有一個classlib.dll文件。然后添加一個控制臺應用程序。引入system.reflaction的命名空間。添加的.代碼如下:

            using system;
            using system.collections.generic;
            using system.linq;
            using system.text;
            using system.reflection;//添加反射的命名空間

            namespace consoleapplication4
            {
                public class program
                {
                    static void main(string[] args)
                    {
                        console.writeline("列出程序集中的所有類型");
                        assembly ass = assembly.loadfrom("classlib.dll");
                        type[] mytype = ass.gettypes();
                        type classperson = null;
                        foreach (type p in mytype)
                        {
                            console.writeline(p.name);
                            if (p.name=="classperson")
                            {

            《1》《2》.net學習心得 相關文章:攜手助學培訓心得讀三字經心得體會小學科學教研員培訓心得小學英語聽課心得學習師德師風心得體會學習于丹論語心得體會2012年師德學習心得體會鄉鎮教研員培訓班學習心得查看更多>> 學習心得體會

            【.net學習心得】相關文章:

            一套.net筆試題01-12

            NET程序員簡歷范文08-23

            .net工程師簡歷表格08-26

            ASP.NET筆試題小匯總01-12

            ASP.NET如何防止SQL注入01-08

            網絡ASP.net程序員10-26

            NET程序員專業簡歷范文08-01

            .net程序員英文簡歷范文08-10

            談談ASP和ASP.NET的區別01-08

            湖北東潤科技ASP.NET筆試題01-09

                    <pre id="bbfd9"><del id="bbfd9"><dfn id="bbfd9"></dfn></del></pre>

                    <ruby id="bbfd9"></ruby><p id="bbfd9"><mark id="bbfd9"></mark></p>

                    <p id="bbfd9"></p>

                    <p id="bbfd9"><cite id="bbfd9"></cite></p>

                      <th id="bbfd9"><form id="bbfd9"><dl id="bbfd9"></dl></form></th>

                      <p id="bbfd9"><cite id="bbfd9"></cite></p><p id="bbfd9"></p>
                      <p id="bbfd9"><cite id="bbfd9"><progress id="bbfd9"></progress></cite></p>
                      飘沙影院