DynamicSugarStandard 1.0.8
See the version list below for details.
dotnet add package DynamicSugarStandard --version 1.0.8
NuGet\Install-Package DynamicSugarStandard -Version 1.0.8
<PackageReference Include="DynamicSugarStandard" Version="1.0.8" />
paket add DynamicSugarStandard --version 1.0.8
#r "nuget: DynamicSugarStandard, 1.0.8"
// Install DynamicSugarStandard as a Cake Addin #addin nuget:?package=DynamicSugarStandard&version=1.0.8 // Install DynamicSugarStandard as a Cake Tool #tool nuget:?package=DynamicSugarStandard&version=1.0.8
DynamicSugar.net /Standard
What is DynamicSugar.Net?
In 2011 I created the DynamicSugar.net Library which provides methods and classes inspired by the dynamic languages Python and JavaScript to write shorter and more readable source code in C# 4.0.
From 2011 to 2020, the C# language evolved and some features in DynamicSugar became obsolete, like the DynamicSugar string interpolation feature. But most of the features are still useful and I want to use them in my .NET 4.6.1 and .NET Core development in 2023.
In 2023 I moved the library to .NET Standard 2.0, so it can be used with .NET 4.6.1 and .NET Core.
Examples:
List
var intList = DS.List(1,2,3);
var intString = DS.List("a","b");
var l1 = DS.Range(10);
var b = l1.Include(5);
var l2 = l1.Without(0, 2, 4, 6, 8);
var l3 = l1.Without(DS.List(0, 2, 4, 6, 8));
var b = l1.IsEmpty();
Console.WriteLine(l2.Format()); // => 1, 3, 5, 7, 9
Console.WriteLine(l3.Format()); // => 1, 3, 5, 7, 9
var l = DS.List(1,2,3,4).Map( e => e*e );
int i = 1;
if(i.In(1,2,3)) {
// ...
}
var l = DS.List(1,2,3);
if(i.In(l)) {
// ...
}
String Processing
var LastName = "TORRES";
var Age = 45;
var s1 = "LastName:{LastName}, Age:{Age:000}".Template( new { LastName, Age } );
s1 = "LastName:[LastName], Age:[Age]".Template(new { LastName, Age }, "[", "]");
Reflection
var dic = DS.Dictionary(TestDataInstanceManager.TestPersonInstance);
Assert.AreEqual("TORRES", dic["LastName"]);
Assert.AreEqual("Frederic", dic["FirstName"]);
Assert.AreEqual(45, dic["Age"]);
Assert.AreEqual(new DateTime(1964, 12, 11), dic["BirthDay"]);
var dic = DS.Dictionary(TestDataInstanceManager.TestPersonInstance, isPrivate: false);
var lastName = ReflectionHelper.GetProperty(TestDataInstanceManager.TestPersonInstance, "LastName").ToString();
var b = ReflectionHelper.MethodExist(TestDataInstanceManager.TestPersonInstance, "GetLastName");
var privateTitle = ReflectionHelper.GetProperty(TestDataInstanceManager.TestPersonInstance, "PrivateTitle", isPrivate: true);
License:
You may use DynamicSugar.Net under the terms of the MIT License.
NuGet
Install-Package DynamicSugarStandard
Blog Posts:
How to Write a Spelling Corrector? From Python to C# with Dynamic Sugar
Screen Casts:
Platforms:
- Microsoft Windows and Windows Phone, .NET v 4.x
- Xamarin iOS and Android
Outdated
- The extension methods string.Format() and and string.Template() are now out dated, since C# support string interpolation.
- The class MultiValues was an attempt to create functions returning multiple values, which is now supported by C#.
A lot of the features are still useful see Examples
License:
You may use DynamicSugar.Net under the terms of the MIT License.
NuGet
- TODO: Create NuGet Package and publish
Install-Package DynamicSugarCore
Platforms:
- Microsoft Windows and Windows Phone, .NET v 4.x - 2011 - Source
- Xamarin iOS and Android - 2011
- Dot Net Standard 2.0 - 2019
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. |
.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. |
-
.NETStandard 2.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on DynamicSugarStandard:
Package | Downloads |
---|---|
fAI
Fred's experimentation with AI |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.44 | 95 | 9/27/2024 |
1.0.43 | 98 | 9/27/2024 |
1.0.42 | 98 | 9/27/2024 |
1.0.41 | 96 | 9/26/2024 |
1.0.40 | 94 | 9/26/2024 |
1.0.39 | 91 | 9/26/2024 |
1.0.38 | 115 | 7/19/2024 |
1.0.37 | 116 | 7/13/2024 |
1.0.36 | 96 | 7/13/2024 |
1.0.35 | 105 | 7/12/2024 |
1.0.34 | 94 | 7/12/2024 |
1.0.33 | 110 | 7/12/2024 |
1.0.32 | 114 | 7/12/2024 |
1.0.31 | 129 | 5/20/2024 |
1.0.30 | 132 | 4/18/2024 |
1.0.29 | 126 | 3/22/2024 |
1.0.28 | 134 | 3/21/2024 |
1.0.27 | 128 | 3/21/2024 |
1.0.26 | 131 | 3/21/2024 |
1.0.25 | 263 | 3/16/2024 |
1.0.24 | 156 | 3/2/2024 |
1.0.23 | 290 | 2/6/2024 |
1.0.22 | 126 | 2/6/2024 |
1.0.21 | 105 | 2/3/2024 |
1.0.20 | 111 | 2/3/2024 |
1.0.19 | 121 | 2/3/2024 |
1.0.18 | 120 | 1/27/2024 |
1.0.17 | 179 | 1/5/2024 |
1.0.16 | 134 | 1/5/2024 |
1.0.15 | 126 | 1/3/2024 |
1.0.14 | 115 | 1/3/2024 |
1.0.13 | 143 | 1/3/2024 |
1.0.12 | 165 | 12/28/2023 |
1.0.11 | 143 | 12/28/2023 |
1.0.10 | 330 | 12/27/2023 |
1.0.9 | 151 | 12/17/2023 |
1.0.8 | 142 | 12/17/2023 |
1.0.7 | 134 | 12/17/2023 |
1.0.6 | 215 | 12/4/2023 |
1.0.5 | 147 | 12/2/2023 |
1.0.4 | 214 | 11/24/2023 |
1.0.3 | 144 | 11/24/2023 |
1.0.2 | 327 | 11/12/2023 |
1.0.0 | 256 | 2/9/2023 |