C#中的这个冒号意味着什么

时间:2014-07-15 05:05:36

标签: c#

在此代码中:

var hasManyToOne=false;
foreach(var property in entity.Descendants("Property"))
{
  if (property:manyToOne!=null)
  {
    hasManyToOne=true;
  }
}

变量“property”后的冒号是什么意思?这是一个时期吗?我在C#语言中找不到任何显示冒号的引用。

3 个答案:

答案 0 :(得分:5)

这是一个输入错误(因为property.manyToOne中没有XElement)或其他什么,但有一件事是肯定的。

这不是一个有效的C#语法,甚至不会编译。见这里。

enter image description here

答案 1 :(得分:4)

这意味着不能编译的错误代码。

答案 2 :(得分:0)

:不是有效的C#运算符。 http://msdn.microsoft.com/library/6a71f45d.aspx