.NET API Reference
Welcome to the official Microsoft .NET API documentation. This section provides comprehensive reference material for the .NET framework and its related technologies.
Getting Started
Explore the core libraries and popular frameworks to build powerful and efficient applications.
Core Libraries
The .NET Core libraries form the foundation for all .NET applications, providing fundamental types, collections, I/O operations, networking capabilities, and more.
Key Areas
System.Net Namespace
This namespace provides types for network programming, including classes for sending and receiving data over the network, manipulating network addresses, and interacting with network protocols.
HttpClient Class
Provides a class for sending HTTP requests and receiving HTTP responses from a resource identified by a URI.
Dns Class
Provides a managed implementation of the Domain Name System (DNS) client. This class can be used to resolve IP addresses from host names and vice versa.
System.IO Namespace
Provides types that allow reading and writing files and data streams, and types that provide basic file and directory operations.
Featured Topics
String Manipulation
Learn about the powerful string manipulation capabilities in .NET, including methods for searching, replacing, splitting, and formatting strings.
Collections
Discover the various collection types available in .NET, such as lists, dictionaries, and sets, and understand their use cases.
Example: Making an HTTP Request
C# Example
using System;
using System.Net.Http;
using System.Threading.Tasks;
public class Example
{
public static async Task Main(string[] args)
{
using (HttpClient client = new HttpClient())
{
try
{
string url = "https://www.microsoft.com";
HttpResponseMessage response = await client.GetAsync(url);
response.EnsureSuccessStatusCode(); // Throw an exception if the status code is not success
string responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseBody.Substring(0, 200) + "..."); // Display first 200 characters
}
catch (HttpRequestException e)
{
Console.WriteLine($"Request error: {e.Message}");
}
}
}
}