net-standard
  1. net-standard-types-and-members-available

Types and Members Available - (.NET Standard API Surface)

.NET Standard is a set of APIs that are common across all .NET platforms, including .NET Framework, .NET Core, and Xamarin. In this tutorial, we'll discuss the types and members available in the .NET Standard API surface and how to use them in your .NET applications.

Syntax

The syntax for using the .NET Standard API surface depends on the specific type or member that you want to use. The .NET Standard API surface includes a wide range of types and members, such as collections, file access, network access, encryption, and more.

Example

Here's an example of using the StreamWriter class from the .NET Standard API surface to write a string to a file:

using System.IO;

namespace ExampleApplication
{
    class Program
    {
        static void Main(string[] args)
        {
            using (StreamWriter writer = new StreamWriter("example.txt"))
            {
                writer.WriteLine("Hello, world!");
            }
        }
    }
}

In this example, we're using the StreamWriter class to write a string to a file named "example.txt".

Explanation

The .NET Standard API surface includes a wide range of types and members that can be used to build .NET applications. These types and members provide functionality such as file access, network access, encryption, and many others.

To use a type or member from the .NET Standard API surface, you need to include the appropriate namespace in your code. For example, to use the StreamWriter class, you need to include the System.IO namespace.

Use

The .NET Standard API surface can be used to build .NET applications that can run on any .NET platform, including .NET Framework, .NET Core, and Xamarin. By relying on the .NET Standard API surface, you can write code that is portable and can be reused across multiple platforms.

Important Points

Here are some important points to keep in mind when working with the .NET Standard API surface:

  • The .NET Standard API surface provides a subset of the full .NET Framework, but includes many commonly used types and members.
  • You can check the .NET Standard version compatibility for specific types and members using the .NET API Browser or Visual Studio IntelliSense documentation.
  • The .NET Standard API surface is designed to be used with .NET Core, but can also be used with .NET Framework and Xamarin.

Summary

In this tutorial, we've discussed the types and members available in the .NET Standard API surface, which provide a set of common APIs across all .NET platforms. We've covered the syntax, example, explanation, use, and important points of using the .NET Standard API surface in your .NET applications. By leveraging the .NET Standard API surface, you can build portable and reusable code that can run on any .NET platform.

Published on: