C# Net Core常用的API集锦(数万字详细总结)

文章目录

1、HTTP 相关(System.Net.Http)

HttpClient

HttpResponseMessage 和 HttpRequestMessage

2、文件操作(System.IO)

File 类

Directory 类

3、JSON 处理(System.Text.Json)

JsonSerializer

4、数据库访问(Microsoft.EntityFrameworkCore)

DbContext

5、任务和异步编程(System.Threading.Tasks)

Task 和 async/await

6、配置管理(Microsoft.Extensions.Configuration)

IConfiguration

ConfigurationBinder

7、日志记录(Microsoft.Extensions.Logging)

ILogger

LoggingExtensions

8、依赖注入(Microsoft.Extensions.DependencyInjection)

IServiceCollection 和 IServiceProvider

9、数据加密(System.Security.Cryptography)

AesManaged

10、进程间通信(System.IO.Pipes)

NamedPipeServerStream 和 NamedPipeClientStream

11、内存缓存(Microsoft.Extensions.Caching.Memory)

IMemoryCache

MemoryCacheEntryOptions

12、网络编程 - Sockets(System.Net.Sockets)

Socket 类

13、反射(System.Reflection)

Type 类

Assembly 类

14、线程相关(System.Threading)

Thread 类

1、HTTP 相关(System.Net.Http)

HttpClient

介绍: 用于发送 HTTP 请求并接收响应。它支持多种 HTTP 方法,如 GET、POST、PUT、DELETE 等。通过HttpClient,可以方便地与 Web 服务进行交互。 示例:

using System;

using System.Net.Http;


彻底卸载显卡驱动的详细步骤与注意事项
衫憄多多付pos机怎么样(杉德久付pos机靠谱吗)