2008-11-25 113 views
8

我看到的ListView類此簽名:「.. ::」是什麼意思?在C#中?

public ListView..::.ListViewItemCollection Items { get; } 

當我看到的是,「什麼?!」

我搜索了「dot dot colon colon dot」和「.. ::」。在Google上沒有結果。

alt text

+0

魔獸誰是天才? – 2008-11-25 06:52:27

+0

它編譯? ::運算符是命名空間別名運算符,但點?我不知道... – 2008-11-25 07:07:43

回答

13

這不是C#;這是JScript。在C#中,它將是:

public ListView.ListViewItemCollection Items {get; }

這有點不同,因爲ListViewItemCollection是ListView的內部類。

我猜你看到了這個,看着ListView.Items Property (System.Windows.Forms)

如果您查看所有其他語言的列表,它們都以JScript語法列出。你找到了一個文檔錯誤。

-4

ListViewItemCollection是嵌套式的ListView的,這意味着在所述代碼中,收集類ListView的定義內定義,像這樣:

public class ListView { 
    public ListViewItemCollection Items {get;} 

    public class ListViewItemCollection : IList { 
    // more code here 
    } 
} 

我會假設它是編碼只是這種方式保持源代碼樹更清潔一點。這樣,所有與ListView控件關聯的助手集合類都不會分散在整個目錄中。內部類有一些特殊的特徵,但我無法想象的內容在這裏適用。