CleanEngine.Shared.Extension
1.2.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package CleanEngine.Shared.Extension --version 1.2.0
NuGet\Install-Package CleanEngine.Shared.Extension -Version 1.2.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CleanEngine.Shared.Extension" Version="1.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CleanEngine.Shared.Extension" Version="1.2.0" />
<PackageReference Include="CleanEngine.Shared.Extension" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CleanEngine.Shared.Extension --version 1.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: CleanEngine.Shared.Extension, 1.2.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CleanEngine.Shared.Extension@1.2.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CleanEngine.Shared.Extension&version=1.2.0
#tool nuget:?package=CleanEngine.Shared.Extension&version=1.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
CleanEngine.Shared.Extension is an extension for commonly used functions and rapid development.
Extension for value types convert methods
int integerNum = "123".ToInt32();//123
double longNum = "123.456".ToDouble();//123.456
decimal roundDecimal = 123.456m.ToRound(2);//123.46
double roundDouble = 123.456d.ToRound(2);//123.46
Extension for json convert
var json = new { Id = 1, Name = "Levi" }.ToJson();//{"Id":1,"Name":"Levi"}
var obj = "{\"Id\":1,\"Name\":\"Levi\"}".ToObject<Student>();
string result = "{\"name\":\"levi\", \"age\":18}".JsonAppendNode("person", new Person(Address: "shenzhen", Count: 100));
Extension for datetime convert
string now = DateTime.Now.ToStandardString();//2024-03-27 16:32:10
Extension for string
bool isEmpty = "".IsEmpty();//true
bool isEqual = "abc".EqualsIgnoreCase("ABC");//true
bool isNumber = "123".IsNumber();//true
bool isInteger = "123.12".IsInteger();//false
bool isDateTime = "2024-03-27".IsDateTime();//true
File Helper
FilesHelper.AppendOrCreate("x:\\xxx\\xxx.txt", text);//if file not exists, create; And then write text
FilesHelper.AppendOrCreate("x:\\xxx\\xxx.txt", new List<string>() { "123", "456" }););//if file not exists, create; And then write text
Validator Helper
var isIntegerPositive = ValidatorHelper.IsIntegerPositive("-100");//false
var isEnglish = ValidatorHelper.IsEnglishCharacter("abc");//true
var isEnglishAndInteger = ValidatorHelper.IsIntegerAndEnglishCharacter("abc123");//true
HttpClient Helper
//HttpGet/HttpPost with header
var html = new HttpEngine().GetString("https://www.baidu.com", x=>x.WithHeader("Accept-Language", "zh-CN"));
//HttpGet/HttpPost with headers
var html2 = new HttpEngine().GetString("https://www.baidu.com", x => x.WithHeaders(new
{
Host = "www.baidu.com",
Connection= "keep-alive"
}));
//HttpGet/HttpPost response convert to Object
var obj = new HttpEngine().Post<Object>("http://192.168.1.1", x=>x.WithBearerToken("token"));
//HttpGet/HttpPost response convert to List
List<Object> list = new HttpEngine().PostList<Object>("http://192.168.1.1");
Snowflake Id Generator
long id = IdGenerator.DefaultInstance().NextId();//163697223064879104
long distributedId = new IdGenerator(1,1).NextId();//163697287460163584
Reflection Helper
var dept = new Department() { Id = 1, Name = "it" };
string beforValue = ReflectionHelper.SetProperty<Department>(dept, "Name", "hr");//set property by key, value
var json = dept.ToJson();//{"Id":1,"Name":"hr"}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- Newtonsoft.Json (>= 13.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
3.3.2 | 141 | 6/19/2025 |
3.3.0 | 268 | 3/6/2025 |
3.2.1 | 227 | 3/6/2025 |
3.1.0 | 144 | 12/1/2024 |
3.0.2 | 149 | 10/27/2024 |
3.0.1-beta | 125 | 9/23/2024 |
3.0.0-beta | 114 | 9/14/2024 |
2.1.0-beta | 102 | 9/14/2024 |
2.0.2 | 156 | 8/23/2024 |
2.0.1 | 125 | 7/23/2024 |
2.0.0 | 136 | 7/13/2024 |
1.3.2 | 142 | 7/6/2024 |
1.3.1 | 141 | 6/30/2024 |
1.3.0 | 130 | 6/29/2024 |
1.2.5 | 136 | 5/27/2024 |
1.2.4 | 142 | 4/15/2024 |
1.2.1 | 143 | 3/28/2024 |
1.2.0 | 149 | 3/27/2024 |
1.1.9 | 140 | 3/27/2024 |
1.1.7 | 148 | 3/23/2024 |
1.1.6 | 139 | 3/23/2024 |
1.1.5 | 150 | 3/23/2024 |
1.1.4 | 155 | 3/6/2024 |
1.1.3 | 148 | 2/29/2024 |
1.1.2 | 148 | 2/27/2024 |
1.1.1 | 131 | 2/27/2024 |