C#之Windows Form Application與attribute

來源:互聯網
上載者:User

標籤:

1. WPF是什麼: Windows Presentation Foundation, 它提供了統一的編程模型、語言和架構,真正做到了分離介面設計人員與開發人員的工作, WPF由XAML( eXtensible Application Markup Language )語言編寫。

 

2. Windows Form Project是由幾個檔案構成的:它們有不同的功能劃分

 

3. 對於一個應用,最重要的就是對使用者的各種events做出反應,那麼監聽器的實現就非常重要,而VS將監聽器的設計介面化,我們只需要雙擊控制項,VS就會自動產生預設的eventhandler的方法名,完成委託。

 

 

 

Attribute:

1. C# 提供一種對稱為屬性的聲明標記進行定義的機制。可以將屬性置於原始碼的某些實體上以指定附加資訊。可以在運行時通過反射檢索屬性包含的資訊。您可以使用預定義屬性或者定義自己的自訂屬性。

 

2. Attributes and reflection have an intimate relationship with assembly metadata. Attributes are a part of that metadata, and reflection understands metadata, allowing you to extract information about attributes and code. 

 

3. attribute也有很多用途,分為很多類,但是它們都是開發人員設定的警告或者需要注意的地方,如在使用標記了Obsolete特性的方法時會發出警告資訊,而assembly可以設定一些環境變數之類的,attribute還能指定序列化

 

4. 我們也可以自己定義attribute,attribute對輸出沒有影響

 

5. Reflection provides the capability to discover information about a program at runtime. 

   1.Viewing metadata(可用於bug的資訊檢索)   2.Performing type discovery   3.Late binding to methods and properties   4.Creating types at runtime (reflection emit)

C#之Windows Form Application與attribute

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.