Earl wrote:
In VB.Net, the following declaration builds and executes with no exceptions:
Dim XMLDoc As New XmlDocument
Dim Node As XmlNode
But in C#, the following (equivalent?!) returns the build error "XMLNode
does not exist in the current context.":
XmlDocument XMLDoc = new XmlDocument();
XmlNode Node = XMLNode;
Your translation is awry. You have the first line right: the translation of
Dim variable_name As New type_for_variable
(a declaration and and assignment in one) is indeed
type_for_variable variable_name = new type_for_variable();
, and is in fact one of the rare cases where VB uses fewer characters
than C#. But where VB does a simple declaration:
Dim variable_name As type_for_variable
without actually assigning any value to variable_name, the C# maintains
its usual terseness-advantage:
type_for_variable variable_name;
--
Larry Lard
la*******@googlemail.com
The address is real, but unread - please reply to the group
For VB and C# questions - tell us which version