ildasm

Keep the delegate argument names when compiling C++/CLI for .Net

左心房为你撑大大i 提交于 2019-12-02 05:33:51
In C# I can get Visual Studio to keep the delegate's argument names. For example if I have: public delegate void Blah(object myArg); public event Blah Foo; Then when I add a method to the event, Visual Studio UI automatically keeps the names and creates the method: void Form1_Foo(object myArg); But, if I declare a delegate in C++/CLI: public: delegate void Blah(Object^ myArg); event Blah^ Foo; it doesn't keep the names and creates a method with nonsense names: void Form1_Foo(object A_0) How can I set meaningful names to the argument in C++/CLI ? EDIT (Added ildasm results): C++ CLI event:

Why is the .ctor() created when I compile C# code into IL?

你说的曾经没有我的故事 提交于 2019-11-30 17:35:54
With this simple C# code, I run csc hello.cs; ildasm /out=hello.txt hello.exe . class Hello { public static void Main() { System.Console.WriteLine("hi"); } } This is the IL code from ildasm. .class private auto ansi beforefieldinit Hello extends [mscorlib]System.Object { .method public hidebysig static void Main() cil managed { .entrypoint // Code size 13 (0xd) .maxstack 8 IL_0000: nop IL_0001: ldstr "hi" IL_0006: call void [mscorlib]System.Console::WriteLine(string) IL_000b: nop IL_000c: ret } // end of method Hello::Main .method public hidebysig specialname rtspecialname instance void .ctor(

Why is the .ctor() created when I compile C# code into IL?

孤街浪徒 提交于 2019-11-30 16:37:42
问题 With this simple C# code, I run csc hello.cs; ildasm /out=hello.txt hello.exe . class Hello { public static void Main() { System.Console.WriteLine("hi"); } } This is the IL code from ildasm. .class private auto ansi beforefieldinit Hello extends [mscorlib]System.Object { .method public hidebysig static void Main() cil managed { .entrypoint // Code size 13 (0xd) .maxstack 8 IL_0000: nop IL_0001: ldstr "hi" IL_0006: call void [mscorlib]System.Console::WriteLine(string) IL_000b: nop IL_000c: ret