Rystem 4.0.63
See the version list below for details.
dotnet add package Rystem --version 4.0.63
NuGet\Install-Package Rystem -Version 4.0.63
<PackageReference Include="Rystem" Version="4.0.63" />
paket add Rystem --version 4.0.63
#r "nuget: Rystem, 4.0.63"
// Install Rystem as a Cake Addin #addin nuget:?package=Rystem&version=4.0.63 // Install Rystem as a Cake Tool #tool nuget:?package=Rystem&version=4.0.63
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.Interactive (>= 6.0.1)
- System.Interactive.Async (>= 6.0.1)
- 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 | 22,259 | 11/16/2024 |
9.0.0-rc.1 | 237 | 10/18/2024 |
6.2.0 | 219,552 | 10/9/2024 |
6.1.2 | 97 | 10/9/2024 |
6.1.1 | 390 | 10/9/2024 |
6.1.0 | 48,264 | 9/29/2024 |
6.0.24 | 647 | 9/11/2024 |
6.0.23 | 340,598 | 7/18/2024 |
6.0.22 | 106 | 7/18/2024 |
6.0.21 | 495 | 6/18/2024 |
6.0.20 | 728,094 | 6/16/2024 |
6.0.19 | 30,953 | 6/14/2024 |
6.0.18 | 454 | 6/14/2024 |
6.0.17 | 456 | 6/14/2024 |
6.0.16 | 50,326 | 6/10/2024 |
6.0.15 | 452 | 6/9/2024 |
6.0.14 | 94,814 | 5/24/2024 |
6.0.13 | 464 | 5/23/2024 |
6.0.12 | 377 | 5/23/2024 |
6.0.11 | 470 | 5/20/2024 |
6.0.9 | 493 | 5/19/2024 |
6.0.7 | 476 | 5/18/2024 |
6.0.6 | 429 | 5/10/2024 |
6.0.5 | 376 | 5/10/2024 |
6.0.4 | 550,393 | 4/3/2024 |
6.0.3 | 1,733 | 3/25/2024 |
6.0.2 | 380,385 | 3/11/2024 |
6.0.1 | 51,102 | 3/8/2024 |
6.0.0 | 1,171,480 | 11/21/2023 |
6.0.0-rc.6 | 190 | 10/25/2023 |
6.0.0-rc.5 | 140 | 10/25/2023 |
6.0.0-rc.4 | 109 | 10/23/2023 |
6.0.0-rc.3 | 113 | 10/19/2023 |
6.0.0-rc.2 | 179 | 10/18/2023 |
6.0.0-rc.1 | 205 | 10/16/2023 |
5.0.20 | 640,762 | 9/25/2023 |
5.0.19 | 2,909 | 9/10/2023 |
5.0.18 | 2,212 | 9/6/2023 |
5.0.17 | 2,037 | 9/6/2023 |
5.0.16 | 2,125 | 9/5/2023 |
5.0.15 | 2,088 | 9/5/2023 |
5.0.14 | 2,091 | 9/5/2023 |
5.0.13 | 2,176 | 9/1/2023 |
5.0.12 | 2,031 | 8/31/2023 |
5.0.11 | 2,030 | 8/30/2023 |
5.0.10 | 2,057 | 8/29/2023 |
5.0.9 | 2,096 | 8/24/2023 |
5.0.8 | 2,106 | 8/24/2023 |
5.0.7 | 451,581 | 8/23/2023 |
5.0.6 | 19,613 | 8/21/2023 |
5.0.5 | 6,277 | 8/21/2023 |
5.0.4 | 2,161 | 8/16/2023 |
5.0.3 | 214,865 | 8/2/2023 |
5.0.2 | 3,910 | 8/2/2023 |
5.0.1 | 13,702 | 8/1/2023 |
5.0.0 | 14,017 | 7/31/2023 |
4.1.26 | 143,205 | 7/20/2023 |
4.1.25 | 24,684 | 7/16/2023 |
4.1.24 | 402,168 | 6/13/2023 |
4.1.23 | 47,789 | 6/13/2023 |
4.1.22 | 131,787 | 5/30/2023 |
4.1.21 | 57,881 | 5/20/2023 |
4.1.20 | 407,151 | 4/19/2023 |
4.1.19 | 97,845 | 3/20/2023 |
4.1.18 | 2,494 | 3/20/2023 |
4.1.17 | 2,787 | 3/16/2023 |
4.1.16 | 2,537 | 3/16/2023 |
4.1.15 | 2,935 | 3/15/2023 |
4.1.14 | 12,349 | 3/9/2023 |
4.1.13 | 2,654 | 3/7/2023 |
4.1.12 | 3,020 | 2/9/2023 |
4.1.11 | 2,663 | 1/26/2023 |
4.1.10 | 2,911 | 1/22/2023 |
4.1.9 | 2,520 | 1/20/2023 |
4.1.8 | 2,715 | 1/18/2023 |
4.1.7 | 2,767 | 1/18/2023 |
4.1.6 | 2,614 | 1/17/2023 |
4.1.5 | 364 | 1/15/2023 |
4.1.4 | 362 | 1/15/2023 |
4.1.3 | 358 | 1/15/2023 |
4.1.2 | 375 | 1/15/2023 |
4.1.1 | 2,605 | 1/4/2023 |
4.1.0 | 2,795 | 12/30/2022 |
4.0.102 | 2,799 | 12/21/2022 |
4.0.101 | 797 | 12/20/2022 |
4.0.100 | 353 | 12/19/2022 |
4.0.99 | 373 | 12/18/2022 |
4.0.98 | 6,453 | 12/7/2022 |
4.0.97 | 364 | 12/7/2022 |
4.0.96 | 361 | 12/7/2022 |
4.0.95 | 361 | 12/7/2022 |
4.0.94 | 4,354 | 12/1/2022 |
4.0.93 | 392 | 12/1/2022 |
4.0.92 | 3,345 | 11/29/2022 |
4.0.91 | 8,572 | 11/22/2022 |
4.0.90 | 4,581 | 11/18/2022 |
4.0.89 | 4,310 | 11/18/2022 |
4.0.88 | 4,454 | 11/15/2022 |
4.0.87 | 4,397 | 11/14/2022 |
4.0.86 | 4,523 | 11/13/2022 |
4.0.85 | 4,821 | 11/2/2022 |
4.0.84 | 4,526 | 11/2/2022 |
4.0.83 | 4,692 | 10/29/2022 |
4.0.82 | 4,795 | 10/29/2022 |
4.0.81 | 1,731 | 10/29/2022 |
4.0.80 | 14,111 | 10/16/2022 |
4.0.79 | 4,310 | 10/9/2022 |
4.0.78 | 456 | 10/9/2022 |
4.0.77 | 443 | 10/8/2022 |
4.0.76 | 21,485 | 10/5/2022 |
4.0.75 | 43,709 | 9/20/2022 |
4.0.74 | 4,851 | 9/20/2022 |
4.0.73 | 4,493 | 9/20/2022 |
4.0.72 | 680 | 9/20/2022 |
4.0.71 | 3,970 | 9/20/2022 |
4.0.70 | 551 | 9/14/2022 |
4.0.69 | 522 | 9/14/2022 |
4.0.68 | 4,725 | 9/13/2022 |
4.0.67 | 487 | 9/1/2022 |
4.0.66 | 4,478 | 8/19/2022 |
4.0.65 | 467 | 8/19/2022 |
4.0.64 | 479 | 8/19/2022 |
4.0.63 | 502 | 8/16/2022 |
4.0.62 | 515 | 8/16/2022 |
4.0.61 | 458 | 8/16/2022 |
4.0.60 | 493 | 8/14/2022 |
4.0.59 | 510 | 8/13/2022 |
4.0.58 | 484 | 8/13/2022 |
4.0.57 | 515 | 8/13/2022 |
4.0.56 | 489 | 8/13/2022 |
4.0.54 | 514 | 8/13/2022 |
4.0.53 | 505 | 8/12/2022 |
4.0.52 | 474 | 8/11/2022 |
4.0.51 | 499 | 8/9/2022 |
4.0.50 | 503 | 8/8/2022 |
4.0.49 | 492 | 8/8/2022 |
4.0.48 | 489 | 8/8/2022 |
4.0.47 | 495 | 8/6/2022 |
4.0.46 | 476 | 8/6/2022 |
4.0.45 | 487 | 8/5/2022 |
4.0.44 | 469 | 8/5/2022 |
4.0.43 | 495 | 8/4/2022 |
4.0.42 | 502 | 8/4/2022 |
4.0.41 | 499 | 8/4/2022 |
4.0.40 | 487 | 8/3/2022 |
4.0.39 | 494 | 8/3/2022 |
4.0.38 | 4,826 | 7/30/2022 |
4.0.37 | 4,543 | 7/29/2022 |
4.0.36 | 4,008 | 7/29/2022 |
4.0.35 | 492 | 7/29/2022 |
4.0.34 | 789 | 7/29/2022 |
4.0.33 | 4,749 | 7/29/2022 |
4.0.32 | 4,551 | 7/29/2022 |
4.0.31 | 501 | 7/29/2022 |
4.0.30 | 505 | 7/29/2022 |
4.0.29 | 4,610 | 7/27/2022 |
4.0.28 | 546 | 7/27/2022 |
4.0.26 | 4,516 | 7/27/2022 |
4.0.25 | 4,166 | 7/26/2022 |
4.0.24 | 4,661 | 7/25/2022 |
4.0.23 | 4,577 | 7/25/2022 |
4.0.22 | 4,473 | 7/22/2022 |
4.0.21 | 4,512 | 7/19/2022 |
4.0.20 | 4,551 | 7/19/2022 |
4.0.19 | 515 | 7/19/2022 |
4.0.18 | 4,562 | 7/19/2022 |
4.0.17 | 4,591 | 7/19/2022 |
4.0.16 | 4,649 | 7/18/2022 |
4.0.15 | 4,513 | 7/18/2022 |
4.0.14 | 523 | 7/18/2022 |
4.0.13 | 4,574 | 7/18/2022 |
4.0.12 | 4,082 | 7/17/2022 |
4.0.11 | 1,489 | 7/17/2022 |
4.0.10 | 528 | 7/17/2022 |
4.0.9 | 1,173 | 7/17/2022 |
4.0.8 | 13,810 | 7/15/2022 |
4.0.7 | 5,776 | 7/15/2022 |
4.0.6 | 6,505 | 7/8/2022 |
4.0.5 | 6,223 | 7/6/2022 |
4.0.4 | 11,392 | 7/1/2022 |
4.0.3 | 1,336 | 6/29/2022 |
4.0.1 | 1,821 | 6/29/2022 |
4.0.0 | 1,313 | 6/27/2022 |
3.0.2 | 1,170 | 5/5/2022 |
3.0.1 | 1,446 | 11/30/2021 |
3.0.0 | 1,398 | 11/12/2021 |
2.0.12 | 2,462 | 10/14/2021 |
2.0.11 | 1,541 | 10/14/2021 |
2.0.8 | 2,343 | 10/6/2021 |
2.0.7 | 1,726 | 10/2/2021 |
2.0.6 | 472 | 9/30/2021 |
2.0.5 | 427 | 9/30/2021 |
2.0.4 | 1,541 | 9/29/2021 |
2.0.3 | 1,644 | 9/28/2021 |
2.0.2 | 1,352 | 9/26/2021 |
2.0.1 | 1,229 | 9/24/2021 |
2.0.0 | 1,308 | 9/22/2021 |
1.4.0 | 1,391 | 9/14/2021 |
1.3.18 | 1,303 | 9/10/2021 |
1.3.17 | 1,118 | 9/9/2021 |
1.3.16 | 1,434 | 8/28/2021 |
1.3.15 | 1,193 | 8/26/2021 |
1.3.14 | 1,169 | 8/19/2021 |
1.3.13 | 1,180 | 8/13/2021 |
1.3.12 | 1,232 | 8/12/2021 |
1.3.11 | 504 | 7/29/2021 |
1.3.10 | 1,278 | 7/27/2021 |
1.3.9 | 1,231 | 7/27/2021 |
1.3.1 | 1,306 | 7/25/2021 |
1.3.0 | 1,969 | 7/17/2021 |
1.2.4 | 1,252 | 7/14/2021 |
1.2.3 | 454 | 7/14/2021 |
1.2.2 | 430 | 7/14/2021 |
1.2.1 | 1,301 | 7/14/2021 |
1.2.0 | 2,558 | 7/13/2021 |
1.1.0 | 655 | 4/14/2021 |
1.0.3 | 419 | 4/13/2021 |
1.0.2 | 422 | 4/13/2021 |
1.0.1 | 422 | 4/13/2021 |
1.0.0 | 438 | 4/12/2021 |