I needed SNMP support for an ASP.NET application that I maintain. There are several options for getting SNMP in .NET. One apparently is that SNMP is supported by means of WMI. I couldn’t find it.
Perhaps that’s because I only needed to support sending SNMP traps and not receiving SNMP requests and what have you not.
For sending SNMP traps there are several libraries available, but the Win32 API itself also supports it. So I decided to use that.
There are two ways for using the ‘old’ Win32 API from .NET.
One is P/Invoke. You sort of import the Win32 API into your C# application and then call it from there as a static function.
The other way is create a Managed C++ library. From Managed C++ you can combine both managed and unmanaged code. I’ve done the first, so I decided to try the second.
It has been close to 2 years since I had last worked with C++. Since then I’ve done only C# and boy have I become sopiled.
I thought the C++ code looked ugly and I really missed the all the stuff the Visual Studio editor does for me in C#. It’s the same editor for C++, so why doesn’t it do that stuff for me too?
The C++ intellisense isn’t even a tenth as good as the intellisense for C# and there are a lot of little things. I understand that some things are there because it’s set in stone (the ANSI C++ standard), but Microsoft has already made some unofficial additions to their C++ compiler, why not add a few more to make life easier for developers.
All in all it was an interesting exercise. Also because I needed both a .NET 1.1 and a .NET 2.0 class library, so I also discovered some of the changes between Managed C++ 1.x and Managed C++ 2.0. Let me tell you 2.0 is an enormous improvement!
I really hope I won’t have to do much C++ stuff in the future. I loved programming in C++ and it has taught me a lot of things about OOP, but C# is way more fun and a lot easier to be productive in. The code looks cleaner. I like it way better then C++.
[Last played: Rage Against The Machine - Wake up]