J
J André Labuschagné
Hi All
I have a line of code that works in VB.NET but I get the following error
when converted to C#. The code in VB is:
Dim elementToEncryptDOM As XmlElement =
xmlDocument.GetElementByTagName(elementToEncrypt)(0)
elementToEncrypt is a string passed to the function
My incorrect code in C# is:
XmlDocument xmlDocument = new XmlDocument();
XmlElement elementToEncryptDOM =
xmlDocument.GetElementsByTagName(elementToEncrypt)[0];
The error I get is:
Cannot implicitly convert type 'System.Xml.XmlNode' to
'System.Xml.XmlElement'. An explicit conversion exists (are you missing a
cast?)
System.Xml is included.
I think I am missing a new somewhere.
I am really hoping someone can throw light on this.
Cheers
Andre
I have a line of code that works in VB.NET but I get the following error
when converted to C#. The code in VB is:
Dim elementToEncryptDOM As XmlElement =
xmlDocument.GetElementByTagName(elementToEncrypt)(0)
elementToEncrypt is a string passed to the function
My incorrect code in C# is:
XmlDocument xmlDocument = new XmlDocument();
XmlElement elementToEncryptDOM =
xmlDocument.GetElementsByTagName(elementToEncrypt)[0];
The error I get is:
Cannot implicitly convert type 'System.Xml.XmlNode' to
'System.Xml.XmlElement'. An explicit conversion exists (are you missing a
cast?)
System.Xml is included.
I think I am missing a new somewhere.
I am really hoping someone can throw light on this.
Cheers
Andre