T1.Standard 1.0.67

.NET Standard 2.0
dotnet add package T1.Standard --version 1.0.67
NuGet\Install-Package T1.Standard -Version 1.0.67
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="T1.Standard" Version="1.0.67" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add T1.Standard --version 1.0.67
#r "nuget: T1.Standard, 1.0.67"
#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.
// Install T1.Standard as a Cake Addin
#addin nuget:?package=T1.Standard&version=1.0.67

// Install T1.Standard as a Cake Tool
#tool nuget:?package=T1.Standard&version=1.0.67

Add Parse

Release Notes: https://mr-brain.github.io/categories/t1-standard/

T1.Standard.Collections.TreeBuilder

ReduceTree

Universal way to convert List of items to Tree, Build the tree as completely as possible

var userList = new[]
{
	 new MyUser { Path = "", Name = "A1" },
	 new MyUser { Path = "", Name = "A2" },
	 new MyUser { Path = "demo", Name = "B1" }
};

var actual = _treeBuilder.ReduceTree(userList,
	 x => x.Path,
	 x => _treeBuilder.GetParentPath(x),
	 x => _treeBuilder.QueryParentPaths(x.Path)
).ToList();

var expected = new List<TreeBuilder.TreeItem<MyUser, string>>
{
	 new TreeBuilder.TreeItem<MyUser, string>()
	 {
		  Id = "",
		  ParentId = null,
		  Item = new MyUser {Path = "", Name = "A1"},
		  Children = new List<TreeBuilder.TreeItem<MyUser, string>>()
	 },
	 new TreeBuilder.TreeItem<MyUser, string>()
	 {
		  Id = "",
		  ParentId = null,
		  Item = new MyUser {Path = "", Name = "A2"},
		  Children = new List<TreeBuilder.TreeItem<MyUser, string>>()
	 },
	 new TreeBuilder.TreeItem<MyUser, string>()
	 {
		  Id = "demo",
		  ParentId = null,
		  Item = new MyUser {Path = "demo", Name = "B1"},
		  Children = new List<TreeBuilder.TreeItem<MyUser, string>>()
	 },
};

expected.ToExpectedObject().ShouldEqual(actual);

GenerateTree

This will only create a fully structured tree

var userList = new[]
{
	 new MyUser {Path = "", Name = "A1"},
	 new MyUser {Path = "demo/name", Name = "C1"},
};

var actual = _treeBuilder.GenerateTree(userList,
	 x => x.Path,
	 x => _treeBuilder.GetParentPath(x.Path)
).ToList();

var expected = new List<TreeBuilder.TreeItem<MyUser, string>>
{
	 new TreeBuilder.TreeItem<MyUser, string>()
	 {
		  Id = "",
		  ParentId = null,
		  Item = new MyUser {Path = "", Name = "A1"},
		  Children = new List<TreeBuilder.TreeItem<MyUser, string>>()
	 },
};

expected.ToExpectedObject().ShouldEqual(actual);

string/object Dictionary List to DataTable Sample

var dictList = new List<Dictionary<string, object>> {
	new Dictionary<string, object>
	{
		{"Id", 1},
		{"Name", "Jack"},
		{"Birth", DateTime.Parse("2022-05-01")}
	},
	new Dictionary<string, object>
	{
		{"Id", 2},
		{"Name", "Flash"},
		{"Birth", DateTime.Parse("2022-05-01")}
	}
};

var datatable = dictList.ToDataTable();

string/object Dictionary List Deep to DataTable Sample

var dictList = new List<Dictionary<string, object>> {
	new Dictionary<string, object>
	{
		{"Id", 1},
		{"Name", "Jack"},
		{"Birth", DateTime.Parse("2022-05-01")},
		{"Price", null},
	},
	new Dictionary<string, object>
	{
		{"Id", 2},
		{"Name", "Flash"},
		{"Birth", DateTime.Parse("2022-05-01")},
		{"Price", 123m},
		{"Home", null},
	}
};

var datatable = dictList.DeepToDataTable();

Assert.Equal(typeof(decimal), dt.Columns["Price"]!.DataType);
Assert.Equal(typeof(string), dt.Columns["Home"]!.DataType);
Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net461 net462 net463 net47 net471 net472 net48 net481
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (8)

Showing the top 5 NuGet packages that depend on T1.Standard:

Package Downloads
FlashElf.ChaosKit.Autofac

Package Description

FlashElf.ChaosKit

Chaos strategy is a software development strategy based on the chaos model. Its main rule is to always solve the most important problems first.

T1.AspNetCore3

DynamicHub, DefaultRequestResponseLoggingHandler, RawHtmlInjectMiddleware, ProtectFolderMiddleware

T1.RedisEx

Package Description

T1.SqlLocalData

windows sqllocaldb tool

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.67 157 2/8/2023
1.0.66 339 8/8/2022
1.0.65 335 6/27/2022
1.0.63 281 6/1/2022
1.0.62 298 5/4/2022
1.0.61 518 4/26/2022
1.0.59 316 4/21/2022
1.0.58 2,318 2/15/2022
1.0.57 405 6/30/2021
1.0.54 1,735 1/17/2021
1.0.53 444 1/12/2021
1.0.52 1,108 12/29/2020
1.0.50 2,920 12/9/2020
1.0.49 655 12/8/2020
1.0.45 886 11/18/2020
1.0.44 315 11/15/2020
1.0.42 375 9/3/2020
1.0.40 417 9/2/2020
1.0.38 2,159 9/1/2020
1.0.37 607 8/29/2020
1.0.36 374 8/26/2020
1.0.35 1,961 8/20/2020
1.0.33 385 7/29/2020
1.0.32 681 7/14/2020
1.0.31 418 6/19/2020
1.0.30 1,164 4/29/2020
1.0.29 408 4/5/2020
1.0.28 384 3/30/2020
1.0.26 399 3/27/2020
1.0.25 384 3/20/2020
1.0.24 635 1/31/2020
1.0.23 492 10/31/2019
1.0.22 409 10/12/2019
1.0.19 524 10/8/2019
1.0.18 413 10/5/2019
1.0.17 513 9/28/2019
1.0.16 405 9/11/2019
1.0.15 432 9/8/2019
1.0.14 473 8/22/2019
1.0.10 455 8/18/2019
1.0.6 435 7/27/2019
1.0.0 518 3/16/2019

add ParseCommandArgsLine