If you don't know that tool yet, stop reading and ... stop reading ... and download it from http://www.aisto.com/roeder/dotnet/. This is a must have for any serious .NET developer.
Actually one of the very first things I do after installing VS.NET 200x is to add it as the first tool under the Tools menu in the IDE.
Title: .NET ReflectorCommand: D:\Bits\NET Reflector\Reflector.exeArguments: $(TargetPath)Initial Directory: $(TargetDir)
I use it all the time to better understand what the C# and the C++/CLI compilers generate and to look at our "own source code", disassembled. The second one I put down there is ILDasm.
Now, imagine my joy when Dean offered me to be alpha tester for his .NET Reflector C++/CLI Add-in! Although I have not tried that yet, he tells me it supports function-try-block!
An example from System::Text::StringBuilder::Append:
public:System::Text::StringBuilder^ Append(System::String^ value){ if (value != nullptr) { System::String^ text1 = this->m_StringValue; System::IntPtr ptr1 = System::Threading::Thread::InternalGetCurrentThread(); if (this->m_currentThread != ptr1) { text1 = System::String::GetStringForStringBuilder(text1, text1->Capacity); } int num1 = text1->Length; int num2 = (num1 + value->Length); if (this->NeedsAllocation(text1, num2)) { System::String^ text2 = this->GetNewString(text1, num2); text2->AppendInPlace(value, num1); this->ReplaceString(ptr1, text2); } else { text1->AppendInPlace(value, num1); this->ReplaceString(ptr1, text1); } }
return this;
}
As soon as this will be ready, he'll discuss with Lutz to integrate his code into the .NET Reflector. Good times are coming your way. Chapeau Dean!
BTW, I don't know about you, but I can't stand this design guideline that says that a nullptr String reference should be treated the same way as a reference to an empty String instance... Open door to hidden bugs if you ask me!