Training
Module
Call methods from the .NET Class Library using C# - Training
Use functionality in the .NET Class Library by calling methods that return values, accept input parameters, and more.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
The following articles show the various ways of doing "native interoperability" in .NET.
There are a few reasons why you'd want to call into native code:
The previous list doesn't cover all of the potential situations and scenarios in which the developer would want/like/need to interface with native components. .NET class library, for instance, uses the native interoperability support to implement a fair number of its APIs, like console support and manipulation, file system access and others. However, it's important to note that there's an option if needed.
Note
Most of the examples in this section will be presented for all three supported platforms for .NET Core (Windows, Linux and macOS). However, for some short and illustrative examples, just one sample is shown that uses Windows filenames and extensions (that is, "dll" for libraries). This doesn't mean that those features aren't available on Linux or macOS, it was done merely for convenience sake.
.NET feedback
.NET is an open source project. Select a link to provide feedback:
Training
Module
Call methods from the .NET Class Library using C# - Training
Use functionality in the .NET Class Library by calling methods that return values, accept input parameters, and more.