DLLImport attribute

The attribute, [DllImport()], falls under the DllImportAttribute class. It provides the information required to call a function exported from an unmanaged DLL. The minimum prerequisite is that we should pass the name of the DLL which contains the entry point. We can apply this attribute straightforwardly to C# and C++ function definitions. Let's check what the DllImport attribute has inside it. In the code window, click on DllImport and press the F12 key (referred to as the go-to definition). This key is bound to the de-compile command in Visual Studio and will de-compile the selected type, if it can. Upon de-compilation, Visual Studio will display the de-compiled code in a new window. In the de-compiled code of DllImport ...

Get .NET Core 2.0 By Example now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.