Help in converting to C#

P

Patrick.O.Ige

Can someone help me convert the code below to VB.NET.
Thanks

Function getXML(ByVal sourceFile As String)

Dim myRequest As System.Net.WebRequest =
System.Net.WebRequest.Create(sourceFile)

Dim myResponse As System.Net.WebResponse = myRequest.GetResponse()

Dim myReader As System.Xml.XmlTextReader = New
System.Xml.XmlTextReader(myResponse.GetResponseStream())

Dim doc As System.Xml.XmlDocument = New System.Xml.XmlDocument

doc.Load(myReader)

getXML = doc

myResponse.Close()

myReader.Close()

End Function
 
G

Guest

The problem with the developerfusion conversion is that it isn't C# code.
The most obvious problem is that there is no implicit assignment to the
method name in C# like there is in VB.

Our Instant C# VB.NET to C# converter produces:

public object getXML(string sourceFile)
{
object tempgetXML = null;
System.Net.WebRequest myRequest =
System.Net.WebRequest.Create(sourceFile);
System.Net.WebResponse myResponse = myRequest.GetResponse();
System.Xml.XmlTextReader myReader = new
System.Xml.XmlTextReader(myResponse.GetResponseStream());
System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
doc.Load(myReader);
tempgetXML = doc;
myResponse.Close();
myReader.Close();
return tempgetXML;
}

--
David Anton
www.tangiblesoftwaresolutions.com
Home of:
Instant C#: VB.NET to C# Converter
Instant VB: C# to VB.NET Converter
Instant J#: VB.NET to J# Converter
 
G

Guest

See the actual conversion in my other post - note that the developerfusion
conversion for this sample does not produce viable C# code.
--
David Anton
www.tangiblesoftwaresolutions.com
Home of:
Instant C#: VB.NET to C# Converter
Instant VB: C# to VB.NET Converter
Instant J#: VB.NET to J# Converter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top