Interoperability in C#

Programming has been around for some time and we haven’t always had the .Net Framework to make our lives as programmers and support engineers so easy. When we program within the confines of the .Net Framework, we are building managed code. Managed code is compiled in Bytecode. Prior to the .Net Framework we programmed in unmanaged code. Meaning we compiled it directly into a native operating system binary. In most cases, it became a .dll or COM (Component Object Model). Since many systems we create today (managed code) will need to use some of the older code (unmanaged code) there needs to be an interface between to 2 types of code. This interface is called PInvoke (Platform Invoke) which utilizes the DllImport attribute.

Before the nice SMTP .net libraries, there was a popular email program called BLAT. BLAT is coded in unmanaged code. Below is an example of using BLAT with C#, which is managed code.