Native .NET APIs
Compared to .NET wrappers around C DLLs or COM drivers, native .NET APIs provide a better programming experience through the following features:
- Compiled and versioned assemblies
- Fully managed data types with garbage collection and compatibility with other NI software
- Object-oriented design
- Asynchronous methods for long-running operations
- Exceptions for error handling
- IntelliSense help
- Easy addition of references to a project
.NET Source Code Wrapper APIs
.NET source code wrapper APIs are C# and VB.NET source files that provide a thin .NET interface to a C API. National Instruments created source code wrapper APIs to quickly provide rudimentary .NET support before native .NET APIs could be developed. In the future, National Instruments plans to discontinue updates to wrapper APIs.
Choosing Between Native .NET APIs and .NET Source Code Wrapper APIs
National Instruments recommends you use native .NET APIs when they are available because they are easier to program against, provide better documentation, provide better examples, and provide a better installation, maintenance, versioning, and configuration management experience. Choose source code wrapper APIs only when a native .NET API is not available or when you have already built a system using source code wrappers before native .NET APIs were available.
National Instruments plans to continue to support and maintain native .NET APIs, while source code wrapper APIs might be deprecated in the future.
The following table provides a feature comparison between NI native .NET APIs and .NET source code wrapper APIs.
||Native .NET API
||.NET Source Code Wrapper API
||Flat, single-layer, C-like
||Method and property names follow Measurement Studio and IVI guidelines
||Method and property names are mapped from C names
||Detailed IntelliSense help. .NET function reference, concept topics, and .NET to C mapping topic
||Limited IntelliSense help, with text copied directly from the C function reference
||Compiled .NET assembly (DLL) targeting specific .NET framework
||C# and VB.NET source code
||Installer installs assemblies, help files, and examples into Program Files for development and assemblies into Global Assembly Cache for execution
||No installer; source code in .zip file
||Several examples demonstrating key concepts
|Warning and exception handling
|| Raises events for warnings. Throws appropriate IVI and .NET Framework exceptions.
||Returns warning code from functions. Throws a single exception.
|Compatibility with Measurement Studio
||Measurement Studio defined .NET datatypes, such as waveforms and precision timing
||Basic datatypes, directly translated from C API