可以somone explian以下代碼中的方括號嗎?方括號在放在類或成員定義之前意味着什麼?
public interface IType : IEditor
{
#region Properties
/// <summary>
/// Genre ID
/// </summary>
int GenreID { get; set; }
/// <summary>
/// Genre name
/// </summary>
[Required]
[DisplayName("Unique System name")]
string Name { get; set; }
/// <summary>
/// Url Genre safe name
/// </summary>
[DisplayName("Unique Url Safe name")]
string UrlSafeName { get; set; }
#endregion
}
它們將VB-ers保留在我們的代碼庫之外!但嚴重的是,你可以在屬性和數組聲明中找到它們:'int []' – 2012-03-15 14:55:47
「C#中的方括號」的第一個Bing結果是[MSDN文檔](http://msdn.microsoft.com/en-us /library/a3hd7ste.aspx),瞭解C#中方括號的用法,包括它們作爲屬性的用法(您顯示的用法)。 [這裏](http://stackoverflow.com/questions/726029/attributes-in-c-sharp)是屬性的一個很好的解釋。 – 2012-03-15 14:56:47
這究竟是如何封閉的「不是一個真正的問題」?這是谷歌第一個「方法定義之前的c#方括號」結果,並回答了我想知道的內容。 – colincameron 2016-09-20 15:10:05