views:

180

answers:

4
if (node.Attributes != null)   //checking for attributes of a xml file node.
+2  A: 
if (node.Attributes != null)

Edit:

you have edit your question VB.Net Equilent code..

If node.Attributes IsNot Nothing Then
Muhammad Akhtar
He _did_ tag it with VB.NET... should have been a clue :)
Oded
It's not the right syntax... Nicky Waites has posted the right syntax (IsNot)
Meta-Knight
+3  A: 

I am assuming you are looking for the equivelant in VB.NET:

If node.Attributes Is Not Nothing Then
Oded
Shouldn't it be IsNot Nothing?
Meta-Knight
I work in VB every day and always use IsNot...
Meta-Knight
Actually I just tested it in the IDE and Is Not Nothing doesn't work...
Meta-Knight
With VB2005 we got the "IsNot" keyword. Previously we had to use the more awkward syntax of "If Not obj Is Nothing Then"
Chris Haas
+1  A: 

If Not (node.Attributes Is Nothing) Then

Rajesh Rolen- DotNet Developer
is this If node.Attributes Is Not Nothing Then return something different ?
Muhammad Akhtar
I prefer IsNot Nothing which is more intuitive than Not ... Is Nothing, but it does work.
Meta-Knight
..though as noted by Chris Haas, in VS2003, it's the only alternative.
Meta-Knight
+1  A: 

I find charp-to-vb a great site for converting between c# and vb.net

In this case

If node.Attributes IsNot Nothing Then
End If
Nicky Waites
error in ur code
Rajesh Rolen- DotNet Developer
Can you explain why you think there is an error? If it is the End If then fair enough since you wont need that with a single statement.
Nicky Waites