c# - .NET 引用源代码中的四个破折号组是什么?

标签 c# .net reference-source

我正在浏览 PluralizationService 的源代码当我注意到一些奇怪的事情时。类里面有几本私有(private)词典,反射(reflect)了不同的多元化规则。例如:

    private string[] _uninflectiveWordList =
        new string[] { 
            "bison", "flounder", "pliers", "bream", "gallows", "proceedings", 
            "breeches", "graffiti", "rabies", "britches", "headquarters", "salmon", 
            "carp", "----", "scissors", "ch----is", "high-jinks", "sea-bass", 
            "clippers", "homework", "series", "cod", "innings", "shears", "contretemps", 
            "jackanapes", "species", "corps", "mackerel", "swine", "debris", "measles", 
            "trout", "diabetes", "mews", "tuna", "djinn", "mumps", "whiting", "eland", 
            "news", "wildebeest", "elk", "pincers", "police", "hair", "ice", "chaos",
            "milk", "cotton", "pneumonoultramicroscopicsilicovolcanoconiosis",
            "information", "aircraft", "scabies", "traffic", "corn", "millet", "rice", 
            "hay", "----", "tobacco", "cabbage", "okra", "broccoli", "asparagus", 
            "lettuce", "beef", "pork", "venison", "mutton",  "cattle", "offspring", 
            "molasses", "shambles", "shingles"};

字符串中的四个破折号是几组?我没有看到它们在代码中得到处理,所以它们不是某种模板。我唯一能想到的是,那些是经过审查的咒骂('ch----is' 将是 'chassis'),在这种情况下,这实际上损害了可读性。还有其他人遇到过这个吗?如果我对实际的完整列表感兴趣,我将如何查看它?

最佳答案

来自使用Reflector查看反编译后的代码,我可以验证编译后的版本中没有“----”,它确实看起来确实是某种审查制度。反编译代码在构造函数中有这个:

this._uninflectiveWordList = new string[] { 
    "bison", "flounder", "pliers", "bream", "gallows", "proceedings", "breeches", "graffiti", "rabies", "britches", "headquarters", "salmon", "carp", "herpes", "scissors", "chassis", 
    "high-jinks", "sea-bass", "clippers", "homework", "series", "cod", "innings", "shears", "contretemps", "jackanapes", "species", "corps", "mackerel", "swine", "debris", "measles", 
    "trout", "diabetes", "mews", "tuna", "djinn", "mumps", "whiting", "eland", "news", "wildebeest", "elk", "pincers", "police", "hair", "ice", "chaos", 
    "milk", "cotton", "pneumonoultramicroscopicsilicovolcanoconiosis", "information", "aircraft", "scabies", "traffic", "corn", "millet", "rice", "hay", "hemp", "tobacco", "cabbage", "okra", "broccoli", 
    "asparagus", "lettuce", "beef", "pork", "venison", "mutton", "cattle", "offspring", "molasses", "shambles", "shingles"
 };

如您所见,被删减的词是“herpes”、“chassis”和“hemp”(如果我没听错的话)。我个人认为这些都不需要审查,这表明它是某种自动化系统在做这件事。我会假设原始源包含它们,而不是将它们添加到某种预编译合并中(如果没有别的,因为“----”真的不足以说明应该用什么代替)。我想出于某种原因,引用网站会对其进行审查。

Hans Passant 也在评论中链接到一个非常相似的问题的答案:What does ----s mean in the context of StringBuilder.ToString()? .这解释了“已发布引用源的源代码通过过滤器推送,该过滤器从源中删除了令人反感的内容”。

关于c# - .NET 引用源代码中的四个破折号组是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33873054/

相关文章:

c# - 为什么 `Int32` 在其源代码中使用 `int`?

c# - ReSharper 9 : Microsoft Reference Source, 而不是反编译的 .cs 文件

c# - 在某些情况下,OptimisticConcurrencyException 在 Entity Framework 中不起作用

c# 强类型数据集,其表适配器未返回预期结果

c# - 如何使用 HTTP 在 C# 中控制设备的嵌入式控制软件?

.net - Entity Framework 与 AssociateWith

c# - Node.js 服务器向 Windows C# 客户端发出命令

.net - 使用 BasicHttpBinding 和 Windows 身份验证使用 WCF 服务

c# - 如何在不使用反射的情况下创建通用属性访问器?