Siegfried Heintze said:
Can someone kindly translate the following line from VB.NET to C#?
Thanks!
Siegfried
outp.WriteLine("starting " & My.Application.Info.AssemblyName &
"/Module1.vb
clr=" & Environment.Version.ToString & " os=" &
My.Computer.Info.OSPlatform &
"v" & My.Computer.Info.OSVersion.ToString)
Give a man a fish...
Console.WriteLine("starting " +
this.GetType().Assembly.GetName().Name.ToString() + " /Module1.vb clr=" +
Environment.Version.ToString() + " os=" +
Environment.OSVersion.Platform.ToString() + " v=" +
Environment.OSVersion.ToString());
Personally, I would use something more like...
Console.WriteLine("starting " +
this.GetType().Assembly.GetName().Name.ToString() + " /Module1.vb clr=" +
Environment.Version.ToString() + " os=" + Environment.OSVersion.ToString());
....Because Environment.OSVersion.Platform.ToString() is redundant in what
you are trying to produce (I think)
....and maybe Module1.vb should now be the name of a .cs file?
Or teach a man to fish...
You can also access the VB My namespace from C# as explained here:
http://www.petermorano.com/Leveraging-VB-MyNamespace-From-CSharp.aspx
if you like using it for these types of statements, trust me I know these
translations can be a little confusing at times.
Roger Frost
"Logic Is Syntax Independent"