D
Daniel P.
MS or anyone still claims that C# and VB.NET generate the exact same IL
code?
http://www.osnews.com/story.php?news_id=5602&page=3
code?
http://www.osnews.com/story.php?news_id=5602&page=3
Daniel said:MS or anyone still claims that C# and VB.NET generate the exact same IL
code?
Daniel P. said:MS or anyone still claims that C# and VB.NET generate the exact same IL
code?
http://www.osnews.com/story.php?news_id=5602&page=3
If they did, then they were misinformed, as the tools
definitely will produce different IL.
- Nicholas Paldino [.NET/C# MVP]
MS or anyone still claims that C# and VB.NET generate the exact same IL
code?
http://www.osnews.com/story.php?news_id=5602&page=3
Cor said:Hi Nicholas,If they did, then they were misinformed, as the tools
definitely will produce different IL.
- Nicholas Paldino [.NET/C# MVP]
Do you have some more information about this for us?
Some samples, official Microsoft links (not to child sites please).
I am waiting full intrest
Cor
You don't need samples. You can just take two simple programs, one in
VB and one in C#, and then compile them. Then, use ILDASM to view the IL.
You will see differences in it.
Cor,Cor said:Hi Nicholas,
That is as you said it in the syntax not in the context
Cor said:That is as you said it in the syntax not in the context
What do you mean by this?
Nicholas Paldino said:Cor,
The following C# code:
using System;
namespace ConsoleApplication22
{
class Class1
{
[STAThread]
public static void Main(string[] args)
{
Console.WriteLine("Hello there");
}
}
}
Compiles to the following IL:
.method public hidebysig static void Main(string[] args) cil managed
{
.entrypoint
.custom instance void [mscorlib]System.STAThreadAttribute::.ctor() = ( 01
00 00 00 )
// Code size 11 (0xb)
.maxstack 1
IL_0000: ldstr "Hello there"
IL_0005: call void [mscorlib]System.Console::WriteLine(string)
IL_000a: ret
} // end of method Class1::Main
The following VB code:
Public Class Class1
Public Shared Sub Main(ByVal args As String())
Console.WriteLine("Hello there")
End Sub
End Class
Compiles to the following IL:
.method public static void Main(string[] args) cil managed
{
.entrypoint
.custom instance void [mscorlib]System.STAThreadAttribute::.ctor() = ( 01
00 00 00 )
// Code size 11 (0xb)
.maxstack 8
IL_0000: ldstr "Hello there"
IL_0005: call void [mscorlib]System.Console::WriteLine(string)
IL_000a: ret
} // end of method Class1::Main
Notice the differences. Specifically:
- The difference in the declaration for Main
- The difference in the maxstack.
And that is just one line of code.
--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)
oneCor said:Hi Nicholas,in
That is as you said it in the syntax not in the context
But forget it we always makes sometimes mistakes
Cor
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.