什么等同放着清单代码下面的C#代码

问题描述:

if (node.Attributes != null) //checking for attributes of a xml file node. 
+0

甚至不是有效C#开始。没有''这样的操作符。 – 2009-12-16 11:36:04

+0

在C#中没有运算符,!=是正确的情况 – 2009-12-16 11:36:08

+0

对不起:if(node.Attributes!= null) – 2009-12-16 11:40:17

如果不是(node.Attributes是没有什么)然后

+0

是这样的如果node.Attributes不是没有然后返回不同的东西? – 2009-12-16 12:00:47

+0

我更喜欢IsNot没有什么比没有更直观...没什么,但它确实有效。 – 2009-12-16 13:08:32

+0

..正如克里斯·哈斯在VS2003中所指出的那样,它是唯一的选择。 – 2009-12-16 15:16:44

if (node.Attributes != null) 

编辑:

你必须编辑您的问题 VB.Net Equilent代码..

If node.Attributes IsNot Nothing Then 
+0

他_did_用VB.NET标记它......应该是一个线索:) – Oded 2009-12-16 11:50:43

+0

这不是正确的语法......尼基怀特斯发布了正确的语法(IsNot) – 2009-12-16 14:03:08

我假设你是在VB.NET中寻找equivelant:

If node.Attributes Is Not Nothing Then 
+0

不应该是IsNot Nothing? – 2009-12-16 13:06:51

+0

我每天在VB工作,总是使用IsNot ... – 2009-12-16 13:59:52

+0

其实我只是在IDE中测试它,并不是没有什么不工作... – 2009-12-16 14:01:06

我发现charp-to-vb一个伟大的网站为C#和vb.net

之间的转换在这种情况下

If node.Attributes IsNot Nothing Then 
End If 
+0

错误代码 – 2009-12-17 05:12:47

+0

你能解释为什么你认为有错误吗?如果这是最终结果,那么因为你不会需要一个单一的陈述。 – 2009-12-17 09:40:36