using System; // 基礎類型、例外處理 using System.Collections; // 非泛型集合 using System.Collections.Generic; // 泛型集合 using System.Linq; // LINQ 查詢 using System.ComponentModel; // 資料綁定、型別轉換 using System.Text; // 文字處理 using System.Text.RegularExpressions; // 正則表達式 using System.Globalization; // 地區和文化資訊 using System.Configuration; // 應用程式配置(.NET Core/5+ 需另裝 System.Configuration.ConfigurationManager NuGet 套件;新專案建議改用 Microsoft.Extensions.Configuration) using System.Runtime.Serialization; // 序列化
2. 檔案與 I/O 處理
1 2 3 4 5 6 7
using System.IO; // 檔案與目錄操作 using System.IO.Compression; // 檔案壓縮 using System.IO.Ports; // 序列埠通訊 using System.Xml; // XML 處理 using System.Xml.Linq; // LINQ to XML using System.Xml.Serialization; // XML 序列化 using System.Xml.Schema; // XML Schema
3. 網路與 Web 開發
1 2 3 4 5 6 7 8 9 10 11 12 13 14
using System.Net; // 基礎網路功能 using System.Net.Http; // HTTP 客戶端 using System.Net.Mail; // 電子郵件 using System.Net.Sockets; // TCP/IP 網路 using System.Web; // Web 應用程式 using System.Web.Http; // Web API using System.Web.Mvc; // ASP.NET MVC using Microsoft.AspNetCore; // .NET Core Web 應用 using Microsoft.AspNetCore.SignalR; // 即時通訊 using Microsoft.AspNetCore.Authentication; // 身份驗證 using Microsoft.AspNetCore.Authorization; // 授權 using Microsoft.Extensions.DependencyInjection; // 依賴注入 using Microsoft.Extensions.Configuration; // 配置 using Microsoft.Extensions.Logging; // 日誌
4. 資料庫存取
1 2 3 4 5 6 7 8 9
using System.Data; // 資料庫通用功能 using Microsoft.Data.SqlClient; // SQL Server 連線(System.Data.SqlClient 已進入維護模式,新專案請用此套件) using System.Data.Entity; // Entity Framework using Microsoft.EntityFrameworkCore; // EF Core using Dapper; // Dapper ORM using Microsoft.Data.Sqlite; // SQLite using Npgsql; // PostgreSQL using MongoDB.Driver; // MongoDB using StackExchange.Redis; // Redis
5. 訊息佇列與事件匯流排
1 2 3 4
using RabbitMQ.Client; // RabbitMQ using Azure.Messaging.ServiceBus; // Azure Service Bus using MassTransit; // MassTransit using Azure.Messaging.EventHubs; // Azure Event Hubs(Microsoft.Azure.EventHubs 為舊版 SDK,已停止新功能開發)
6. 雲端服務整合
1 2 3 4 5
using Azure.Storage.Blobs; // Azure Blob Storage using Azure.Identity; // Azure 身份認證 using Amazon.S3; // AWS S3 using Amazon.SQS; // AWS SQS using Google.Cloud.Storage.V1; // Google Cloud Storage
7. 效能與監控
1 2 3 4 5
using System.Diagnostics; // 效能監控、事件記錄 using OpenTelemetry; // 分散式追蹤 using OpenTelemetry.Metrics; // 指標收集 using App.Metrics; // 應用程式指標(最後穩定版 4.3.0,2021 年後無更新,新專案建議評估 OpenTelemetry) using Prometheus; // Prometheus 監控
8. 快取
1 2 3
using Microsoft.Extensions.Caching.Memory; // 記憶體快取 using Microsoft.Extensions.Caching.StackExchangeRedis; // Redis 快取(舊版 Microsoft.Extensions.Caching.Redis 已棄用) using LazyCache; // 延遲快取
9. 背景工作
1 2 3 4 5
using Hangfire; // 背景工作排程 using Quartz; // 工作排程 using Microsoft.Extensions.Hosting; // 託管服務 using System.Reactive; // 反應式程式設計 using System.Reactive.Linq; // Rx.NET
10. 測試相關
1 2 3 4 5 6
using Microsoft.VisualStudio.TestTools.UnitTesting; // MSTest using Xunit; // xUnit using NUnit.Framework; // NUnit using Moq; // Mock 框架 using FluentAssertions; // 流暢的斷言 using AutoFixture; // 測試資料產生