The .NET framework is becoming increasingly popular in developing Windows applications. However, it is inevitable that there is a time lag before .NET is fully adopted and existing applications are recoded. In particular, there is a large body of legacy code that will likely never be rewritten in .NET. To address this situation, we will show you in the following few examples how to use Microsoft’s assembly and marshaling techniques to call unmanaged C functions from managed C# directly. By doing so, you will be able to reuse your legacy C code.