CurlDotNet - 純 .NET curl

CurlDotNet 是一個開放原始碼的 .NET 函式庫,可讓開發人員直接將 curl 指令貼到 C# 應用程式中 - 無須手動翻譯。

Iron Software 榮幸地贊助 CurlDotNet 以支持 .NET 開源社群。 由 Iron Software 的 CTO 及共同創辦人 Jacob Mellor 建立並維護。

快速入門

dotnet add package CurlDotNet
dotnet add package CurlDotNet
SHELL
using CurlDotNet;

// Paste any curl command directly from documentation
var result = await Curl.ExecuteAsync(
    "curl -X GET https://api.github.com/users/octocat -H 'Accept: application/json'"
);
using CurlDotNet;

// Paste any curl command directly from documentation
var result = await Curl.ExecuteAsync(
    "curl -X GET https://api.github.com/users/octocat -H 'Accept: application/json'"
);
Imports CurlDotNet

' Paste any curl command directly from documentation
Dim result = Await Curl.ExecuteAsync(
    "curl -X GET https://api.github.com/users/octocat -H 'Accept: application/json'"
)
$vbLabelText   $csharpLabel

為何選擇 CurlDotNet?

CurlDotNet 純粹以 C# 實作,沒有任何依賴性。 更重要的是,CurlDotNet 忠實地支援並保留 cURL 的功能與語法。 這意味著

1.Ease-of-Use - 從 API docs、Stack Overflow 或終端機複製並貼上 cURL 指令,並直接在 C# 程式中使用這些指令 (無須翻譯為 HttpClient!) 2.快速遷移 - 從使用 bash 腳本執行 cURL 相關任務轉換到 C#,只需付出最少的努力 3.無學習曲線 - 熟悉 cURL 的開發人員可立即跳至 CurlDotNet 4.Fully-Featured - 存取所有 300+ cURL 選項,輕鬆處理驗證、代理、重試和檔案上傳!

資源: 文件|NuGet|GitHub