diff --git a/README.md b/README.md index 21bfbe8..c137c1f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # ns-ext +[中](README.zh-CN.md) | **En** The **ns-ext** is a .NET extension function library, containing the following types of extension modules: @@ -20,4 +21,45 @@ The **ns-ext** is a .NET extension function library, containing the following ty | Stream type extension | StreamExtensions.cs | | String type extension | StringExtensions.cs | | Prototype type extension | TypeExtensions.cs | -| Resource locator type extension | UriExtensions.cs | \ No newline at end of file +| Resource locator type extension | UriExtensions.cs | + +## Quick start + +### Install + +```shell +dotnet add package NSExt --prerelease +``` + +### Example + +```c# +using NSExt.Extensions; + +internal static class Program +{ + private class Person + { + public string Name { get; set; } + public int Age { get; set; } + } + public static void Main(string[] args) + { + var person = + """ +{ + "Name": "Jason", + "Age": "30" +} +""".Object(); + + Console.WriteLine(person.Json()); + } +} +``` + +### Output + +```json +{"name":"Jason","age":30} +``` \ No newline at end of file diff --git a/README.zh-CN.md b/README.zh-CN.md index 48fefd3..127d239 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -1,4 +1,5 @@ # ns-ext +[En](README.md) | **中** **ns-ext** 是一个.NET扩展函数库,包含以下类型扩展模块: @@ -20,4 +21,45 @@ | 流类型扩展 | StreamExtensions.cs | | 字符串类型扩展 | StringExtensions.cs | | 原型类型扩展 | TypeExtensions.cs | -| 资源定位符类型扩展 | UriExtensions.cs | \ No newline at end of file +| 资源定位符类型扩展 | UriExtensions.cs | + +## 快速开始 + +### 安装 + +```shell +dotnet add package NSExt --prerelease +``` + +### 示例 + +```c# +using NSExt.Extensions; + +internal static class Program +{ + private class Person + { + public string Name { get; set; } + public int Age { get; set; } + } + public static void Main(string[] args) + { + var person = + """ +{ + "Name": "Jason", + "Age": "30" +} +""".Object(); + + Console.WriteLine(person.Json()); + } +} +``` + +### 输出 + +```json +{"name":"Jason","age":30} +``` \ No newline at end of file