Rystem 4.0.39
See the version list below for details.
dotnet add package Rystem --version 4.0.39
NuGet\Install-Package Rystem -Version 4.0.39
<PackageReference Include="Rystem" Version="4.0.39" />
paket add Rystem --version 4.0.39
#r "nuget: Rystem, 4.0.39"
// Install Rystem as a Cake Addin #addin nuget:?package=Rystem&version=4.0.39 // Install Rystem as a Cake Tool #tool nuget:?package=Rystem&version=4.0.39
What is Rystem?
Get Started
Extension methods
Stopwatch
You can monitor the time spent on an action, task or in a method. Some examples from Unit test.
var started = Stopwatch.Start();
//do something
await Task.Delay(2000);
var result = started.Stop();
or
var result = await Stopwatch.MonitorAsync(async () =>
{
await Task.Delay(2000);
});
or with a return value
var result = await Stopwatch.MonitorAsync(async () =>
{
await Task.Delay(2000);
return 3;
});
Linq expression serializer
Usually a linq expression is not serializable as string. With this method you can serialize your expression with some limits. Only primitives are allowed in the expression body. An example from Unit test.
Expression<Func<MakeIt, bool>> expression = ƒ => ƒ.X == q && ƒ.Samules.Any(x => x == k) && ƒ.Sol && (ƒ.X.Contains(q) || ƒ.Sol.Equals(IsOk)) && (ƒ.E == id | ƒ.Id == V) && (ƒ.Type == MakeType.Yes || ƒ.Type == qq);
var serialized = expression.Serialize();
with result
"ƒ => ((((((ƒ.X == \"dasda\") AndAlso ƒ.Samules.Any(x => (x == \"ccccde\"))) AndAlso ƒ.Sol) AndAlso (ƒ.X.Contains(\"dasda\") OrElse ƒ.Sol.Equals(True))) AndAlso ((ƒ.E == Guid.Parse(\"bf46510b-b7e6-4ba2-88da-cef208aa81f2\")) Or (ƒ.Id == 32))) AndAlso ((ƒ.Type == 1) OrElse (ƒ.Type == 2)))"
with deserialization
var newExpression = expressionAsString.Deserialize<MakeIt, bool>();
and usage, for instance, with Linq
var result = makes.Where(newExpression.Compile()).ToList();
you can deserialize and compile at the same time with
var newExpression = expressionAsString.DeserializeAndCompile<MakeIt, bool>();
Reflection helper
Name of calling class
You can find the name of the calling class from your method, with deep = 1 the calling class of your method, with deep = 2 the calling class that calls the class that calls your method, and so on, with fullName set to true you obtain the complete name of the discovered class.
ReflectionHelper.NameOfCallingClass(deep, fullName);
Extensions for Type class
You can get the properties, fields and constructors for your class (and singleton them to save time during new requests)
Type.FetchProperties();
Type.FecthConstructors();
Type.FetchFields();
Mock a Type
If you need to create a type over an abstract class or interface you may use the mocking system of Rystem. For example, if you have an abstract class like this one down below.
public abstract class Alzio
{
private protected string X { get; }
public string O => X;
public string A { get; set; }
public Alzio(string x)
{
X = x;
}
}
you can create an instace of it or simply mock it with
var mocked = typeof(Alzio).CreateInstance("AAA") as Alzio;
mocked.A = "rrrr";
and you can use the class like a real class. You also may do it with
Alzio alzio = null!;
var mocked = alzio.CreateInstance("AAA");
mocked.A = "rrrr";
or
Mocking.CreateInstance<Alzio>("AAA");
you may see "AAA" as argument for your constructor in abstract class.
Text extensions
You may convert as fast as possible byte[] to string or stream to byte[] or byte[] to stream or stream to string or string to stream. For example, string to byte array and viceversa.
string olfa = "daskemnlandxioasndslam dasmdpoasmdnasndaslkdmlasmv asmdsa";
var bytes = olfa.ToByteArray();
string value = bytes.ConvertToString();
For example, string to stream and viceversa.
string olfa = "daskemnlandxioasndslam dasmdpoasmdnasndaslkdmlasmv asmdsa";
var stream = olfa.ToStream();
string value = stream.ConvertToString();
You may read a string with break lines as an enumerable of string
string olfa = "daskemnlandxioasndslam\ndasmdpoasmdnasndaslkdmlasmv\nasmdsa";
var stream = olfa.ToStream();
var strings = new List<string>();
await foreach (var x in stream.ReadLinesAsync())
{
strings.Add(x);
}
A simple method to make uppercase the first character.
string olfa = "dasda";
var olfa2 = olfa.ToUpperCaseFirst();
Character separated-value (CSV)
It's a brand new idea to serialize any kind of objects (with lesser occupied space of json), the idea comes from Command separated-value standard. To serialize
string value = _models.ToCsv();
To deserialize (for instance in a List of a class named CsvModel)
value.FromCsv<List<CsvModel>>();
Extensions for json
I don't know if you are fed up to write JsonSerializer.Serialize, I do, and so, you may use the extension method to serialize faster. To serialize
var text = value.ToJson();
To deserialize in a class (for instance a class named User)
var value = text.FromJson<User>();
Extensions for Task
I don't know if you still are fed up to write .ConfigureAwait(false) to eliminate the context waiting for a task. I do. Why should I set the configure await to false? To set configure await to false
await {your async task}.NoContext();
Instead, to get the result as synchronous result but with a configure await set to false.
{your async task}.ToResult();
You may change the behavior of your NoContext() or ToResult(), setting (in the bootstrap of your application for example)
RystemTask.WaitYourStartingThread = true;
When do I need a true? In windows application for example you have to return after a button clicked to the same thread that started the request.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. 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. |
-
net6.0
- System.Linq.Dynamic.Core (>= 1.2.19)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Rystem:
Package | Downloads |
---|---|
Rystem.DependencyInjection
Rystem is a open-source framework to improve the System namespace in .Net |
|
Rystem.Authentication.Social.Blazor
Rystem.Authentication.Social helps you to integrate with new .Net Identity system and social logins. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
9.0.0 | 176 | 11/16/2024 |
9.0.0-rc.1 | 234 | 10/18/2024 |
6.2.0 | 219,497 | 10/9/2024 |
6.1.2 | 92 | 10/9/2024 |
6.1.1 | 385 | 10/9/2024 |
6.1.0 | 48,261 | 9/29/2024 |
6.0.24 | 645 | 9/11/2024 |
6.0.23 | 340,595 | 7/18/2024 |
6.0.22 | 103 | 7/18/2024 |
6.0.21 | 491 | 6/18/2024 |
6.0.20 | 728,091 | 6/16/2024 |
6.0.19 | 30,901 | 6/14/2024 |
6.0.18 | 451 | 6/14/2024 |
6.0.17 | 453 | 6/14/2024 |
6.0.16 | 50,323 | 6/10/2024 |
6.0.15 | 449 | 6/9/2024 |
6.0.14 | 94,810 | 5/24/2024 |
6.0.13 | 456 | 5/23/2024 |
6.0.12 | 372 | 5/23/2024 |
6.0.11 | 468 | 5/20/2024 |
6.0.9 | 490 | 5/19/2024 |
6.0.7 | 471 | 5/18/2024 |
6.0.6 | 426 | 5/10/2024 |
6.0.5 | 373 | 5/10/2024 |
6.0.4 | 550,390 | 4/3/2024 |
6.0.3 | 1,706 | 3/25/2024 |
6.0.2 | 380,369 | 3/11/2024 |
6.0.1 | 51,099 | 3/8/2024 |
6.0.0 | 1,171,477 | 11/21/2023 |
6.0.0-rc.6 | 187 | 10/25/2023 |
6.0.0-rc.5 | 137 | 10/25/2023 |
6.0.0-rc.4 | 106 | 10/23/2023 |
6.0.0-rc.3 | 110 | 10/19/2023 |
6.0.0-rc.2 | 176 | 10/18/2023 |
6.0.0-rc.1 | 202 | 10/16/2023 |
5.0.20 | 640,759 | 9/25/2023 |
5.0.19 | 2,906 | 9/10/2023 |
5.0.18 | 2,209 | 9/6/2023 |
5.0.17 | 2,034 | 9/6/2023 |
5.0.16 | 2,122 | 9/5/2023 |
5.0.15 | 2,085 | 9/5/2023 |
5.0.14 | 2,088 | 9/5/2023 |
5.0.13 | 2,173 | 9/1/2023 |
5.0.12 | 2,028 | 8/31/2023 |
5.0.11 | 2,027 | 8/30/2023 |
5.0.10 | 2,054 | 8/29/2023 |
5.0.9 | 2,093 | 8/24/2023 |
5.0.8 | 2,103 | 8/24/2023 |
5.0.7 | 451,578 | 8/23/2023 |
5.0.6 | 19,610 | 8/21/2023 |
5.0.5 | 6,273 | 8/21/2023 |
5.0.4 | 2,158 | 8/16/2023 |
5.0.3 | 214,862 | 8/2/2023 |
5.0.2 | 3,907 | 8/2/2023 |
5.0.1 | 13,699 | 8/1/2023 |
5.0.0 | 14,013 | 7/31/2023 |
4.1.26 | 143,200 | 7/20/2023 |
4.1.25 | 24,681 | 7/16/2023 |
4.1.24 | 402,165 | 6/13/2023 |
4.1.23 | 47,786 | 6/13/2023 |
4.1.22 | 131,784 | 5/30/2023 |
4.1.21 | 57,878 | 5/20/2023 |
4.1.20 | 407,148 | 4/19/2023 |
4.1.19 | 97,842 | 3/20/2023 |
4.1.18 | 2,491 | 3/20/2023 |
4.1.17 | 2,784 | 3/16/2023 |
4.1.16 | 2,534 | 3/16/2023 |
4.1.15 | 2,932 | 3/15/2023 |
4.1.14 | 12,345 | 3/9/2023 |
4.1.13 | 2,651 | 3/7/2023 |
4.1.12 | 3,017 | 2/9/2023 |
4.1.11 | 2,660 | 1/26/2023 |
4.1.10 | 2,908 | 1/22/2023 |
4.1.9 | 2,517 | 1/20/2023 |
4.1.8 | 2,712 | 1/18/2023 |
4.1.7 | 2,764 | 1/18/2023 |
4.1.6 | 2,611 | 1/17/2023 |
4.1.5 | 361 | 1/15/2023 |
4.1.4 | 359 | 1/15/2023 |
4.1.3 | 355 | 1/15/2023 |
4.1.2 | 372 | 1/15/2023 |
4.1.1 | 2,602 | 1/4/2023 |
4.1.0 | 2,792 | 12/30/2022 |
4.0.102 | 2,796 | 12/21/2022 |
4.0.101 | 794 | 12/20/2022 |
4.0.100 | 349 | 12/19/2022 |
4.0.99 | 370 | 12/18/2022 |
4.0.98 | 6,450 | 12/7/2022 |
4.0.97 | 361 | 12/7/2022 |
4.0.96 | 358 | 12/7/2022 |
4.0.95 | 358 | 12/7/2022 |
4.0.94 | 4,351 | 12/1/2022 |
4.0.93 | 389 | 12/1/2022 |
4.0.92 | 3,342 | 11/29/2022 |
4.0.91 | 8,569 | 11/22/2022 |
4.0.90 | 4,578 | 11/18/2022 |
4.0.89 | 4,307 | 11/18/2022 |
4.0.88 | 4,451 | 11/15/2022 |
4.0.87 | 4,394 | 11/14/2022 |
4.0.86 | 4,520 | 11/13/2022 |
4.0.85 | 4,818 | 11/2/2022 |
4.0.84 | 4,523 | 11/2/2022 |
4.0.83 | 4,689 | 10/29/2022 |
4.0.82 | 4,792 | 10/29/2022 |
4.0.81 | 1,727 | 10/29/2022 |
4.0.80 | 14,108 | 10/16/2022 |
4.0.79 | 4,307 | 10/9/2022 |
4.0.78 | 453 | 10/9/2022 |
4.0.77 | 440 | 10/8/2022 |
4.0.76 | 21,482 | 10/5/2022 |
4.0.75 | 43,706 | 9/20/2022 |
4.0.74 | 4,848 | 9/20/2022 |
4.0.73 | 4,490 | 9/20/2022 |
4.0.72 | 677 | 9/20/2022 |
4.0.71 | 3,967 | 9/20/2022 |
4.0.70 | 547 | 9/14/2022 |
4.0.69 | 518 | 9/14/2022 |
4.0.68 | 4,722 | 9/13/2022 |
4.0.67 | 484 | 9/1/2022 |
4.0.66 | 4,475 | 8/19/2022 |
4.0.65 | 464 | 8/19/2022 |
4.0.64 | 476 | 8/19/2022 |
4.0.63 | 499 | 8/16/2022 |
4.0.62 | 512 | 8/16/2022 |
4.0.61 | 455 | 8/16/2022 |
4.0.60 | 489 | 8/14/2022 |
4.0.59 | 507 | 8/13/2022 |
4.0.58 | 480 | 8/13/2022 |
4.0.57 | 512 | 8/13/2022 |
4.0.56 | 485 | 8/13/2022 |
4.0.54 | 511 | 8/13/2022 |
4.0.53 | 502 | 8/12/2022 |
4.0.52 | 471 | 8/11/2022 |
4.0.51 | 496 | 8/9/2022 |
4.0.50 | 500 | 8/8/2022 |
4.0.49 | 489 | 8/8/2022 |
4.0.48 | 486 | 8/8/2022 |
4.0.47 | 492 | 8/6/2022 |
4.0.46 | 473 | 8/6/2022 |
4.0.45 | 484 | 8/5/2022 |
4.0.44 | 466 | 8/5/2022 |
4.0.43 | 492 | 8/4/2022 |
4.0.42 | 499 | 8/4/2022 |
4.0.41 | 496 | 8/4/2022 |
4.0.40 | 484 | 8/3/2022 |
4.0.39 | 491 | 8/3/2022 |
4.0.38 | 4,823 | 7/30/2022 |
4.0.37 | 4,540 | 7/29/2022 |
4.0.36 | 4,005 | 7/29/2022 |
4.0.35 | 489 | 7/29/2022 |
4.0.34 | 786 | 7/29/2022 |
4.0.33 | 4,746 | 7/29/2022 |
4.0.32 | 4,548 | 7/29/2022 |
4.0.31 | 498 | 7/29/2022 |
4.0.30 | 502 | 7/29/2022 |
4.0.29 | 4,607 | 7/27/2022 |
4.0.28 | 543 | 7/27/2022 |
4.0.26 | 4,513 | 7/27/2022 |
4.0.25 | 4,163 | 7/26/2022 |
4.0.24 | 4,658 | 7/25/2022 |
4.0.23 | 4,574 | 7/25/2022 |
4.0.22 | 4,470 | 7/22/2022 |
4.0.21 | 4,509 | 7/19/2022 |
4.0.20 | 4,548 | 7/19/2022 |
4.0.19 | 512 | 7/19/2022 |
4.0.18 | 4,559 | 7/19/2022 |
4.0.17 | 4,588 | 7/19/2022 |
4.0.16 | 4,646 | 7/18/2022 |
4.0.15 | 4,510 | 7/18/2022 |
4.0.14 | 520 | 7/18/2022 |
4.0.13 | 4,571 | 7/18/2022 |
4.0.12 | 4,079 | 7/17/2022 |
4.0.11 | 1,486 | 7/17/2022 |
4.0.10 | 525 | 7/17/2022 |
4.0.9 | 1,170 | 7/17/2022 |
4.0.8 | 13,807 | 7/15/2022 |
4.0.7 | 5,773 | 7/15/2022 |
4.0.6 | 6,493 | 7/8/2022 |
4.0.5 | 6,206 | 7/6/2022 |
4.0.4 | 11,389 | 7/1/2022 |
4.0.3 | 1,333 | 6/29/2022 |
4.0.1 | 1,818 | 6/29/2022 |
4.0.0 | 1,310 | 6/27/2022 |
3.0.2 | 1,167 | 5/5/2022 |
3.0.1 | 1,443 | 11/30/2021 |
3.0.0 | 1,395 | 11/12/2021 |
2.0.12 | 2,459 | 10/14/2021 |
2.0.11 | 1,538 | 10/14/2021 |
2.0.8 | 2,340 | 10/6/2021 |
2.0.7 | 1,723 | 10/2/2021 |
2.0.6 | 469 | 9/30/2021 |
2.0.5 | 424 | 9/30/2021 |
2.0.4 | 1,537 | 9/29/2021 |
2.0.3 | 1,641 | 9/28/2021 |
2.0.2 | 1,349 | 9/26/2021 |
2.0.1 | 1,225 | 9/24/2021 |
2.0.0 | 1,305 | 9/22/2021 |
1.4.0 | 1,388 | 9/14/2021 |
1.3.18 | 1,300 | 9/10/2021 |
1.3.17 | 1,115 | 9/9/2021 |
1.3.16 | 1,431 | 8/28/2021 |
1.3.15 | 1,190 | 8/26/2021 |
1.3.14 | 1,166 | 8/19/2021 |
1.3.13 | 1,177 | 8/13/2021 |
1.3.12 | 1,229 | 8/12/2021 |
1.3.11 | 501 | 7/29/2021 |
1.3.10 | 1,275 | 7/27/2021 |
1.3.9 | 1,228 | 7/27/2021 |
1.3.1 | 1,303 | 7/25/2021 |
1.3.0 | 1,966 | 7/17/2021 |
1.2.4 | 1,248 | 7/14/2021 |
1.2.3 | 451 | 7/14/2021 |
1.2.2 | 427 | 7/14/2021 |
1.2.1 | 1,298 | 7/14/2021 |
1.2.0 | 2,555 | 7/13/2021 |
1.1.0 | 652 | 4/14/2021 |
1.0.3 | 416 | 4/13/2021 |
1.0.2 | 419 | 4/13/2021 |
1.0.1 | 419 | 4/13/2021 |
1.0.0 | 435 | 4/12/2021 |