J
James
Hi,
I am trying to optimize some c# code that contains lots of code such as
String name = null;
try
{
name = myXMLElement.Attributes["name"].Value;
}
catch
{
}
[OK - I admit it - It's my code!]
The code needs optimizing, and I suspect throwing exceptions like this is
time consuming. Is there a better way to determine whether attribute node is
present other than the (obvious) enumeration of all the attributes. Has
anybody done any profiling to determine whether this approach is just as
inefficient?
What I'm really looking for is a "HasAttribute" function
Apologies if this has been asked a thousand times before.
James
I am trying to optimize some c# code that contains lots of code such as
String name = null;
try
{
name = myXMLElement.Attributes["name"].Value;
}
catch
{
}
[OK - I admit it - It's my code!]
The code needs optimizing, and I suspect throwing exceptions like this is
time consuming. Is there a better way to determine whether attribute node is
present other than the (obvious) enumeration of all the attributes. Has
anybody done any profiling to determine whether this approach is just as
inefficient?
What I'm really looking for is a "HasAttribute" function
Apologies if this has been asked a thousand times before.
James