简体   繁体   English

C#中“.. ::。”的含义是什么?

[英]What is the meaning of “..::.” in C#?

I saw this signature on the ListView class: 我在ListView类上看到了这个签名:

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

When I saw that, "What?!" 当我看到它时,“什么?!”

I searched "dot dot colon colon dot" and "..::." 我搜索了“点点冒号冒号点”和“.. ::。” on Google with no result. 谷歌没有结果。

替代文字

That's not C#; 那不是C#; that's JScript. 这是JScript。 In C#, it would be: 在C#中,它将是:

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

It's a little different because ListViewItemCollection is an inner class of ListView. 它有点不同,因为ListViewItemCollection是ListView的内部类。

I'm guessing that you saw this looking at ListView.Items Property (System.Windows.Forms) . 我猜你看到了这个看ListView.Items属性(System.Windows.Forms)

If you look at the listing for all the other languages, they're all listed with the JScript syntax. 如果查看所有其他语言的列表,它们都会使用JScript语法列出。 You've found a documentation bug. 您发现了一个文档错误。

ListViewItemCollection is a nested type of ListView, which means that in the code, the Collection class is defined inside of the ListView definition, like so: ListViewItemCollection是ListView的嵌套类型,这意味着在代码中,Collection类是在ListView定义中定义的,如下所示:

public class ListView {
  public ListViewItemCollection Items {get;}

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

I would assume that it is coded this way just to keep their source tree a little bit cleaner. 我认为它是以这种方式编码只是为了保持他们的源代码树更清洁一点。 This way, all of the helper collection classes that are associated with the ListView control aren't scattered throughout the directory. 这样,与ListView控件关联的所有辅助集合类都不会分散在整个目录中。 Inner classes do have a few special characteristics, but none that I can imagine would apply here. 内部类确实有一些特殊的特征,但我无法想象的任何特征都适用于此。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM