我正在浏览 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/