YZ.Helpers 1.0.59

dotnet add package YZ.Helpers --version 1.0.59
                    
NuGet\Install-Package YZ.Helpers -Version 1.0.59
                    
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="YZ.Helpers" Version="1.0.59" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="YZ.Helpers" Version="1.0.59" />
                    
Directory.Packages.props
<PackageReference Include="YZ.Helpers" />
                    
Project file
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 YZ.Helpers --version 1.0.59
                    
#r "nuget: YZ.Helpers, 1.0.59"
                    
#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 YZ.Helpers@1.0.59
                    
#: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=YZ.Helpers&version=1.0.59
                    
Install as a Cake Addin
#tool nuget:?package=YZ.Helpers&version=1.0.59
                    
Install as a Cake Tool

YZ.Helpers

YZ.Helpers is a collection of extension methods and small types that simplify routine .NET development tasks.

Installation

 dotnet add package YZ.Helpers

Features

  • String parsing and formatting
  • Numeric calculations
  • Date and time utilities
  • Geometry and geolocation helpers
  • File and network tools
  • JSON serialization based on Newtonsoft.Json
  • Logging and diagnostic helpers

Quick Start

Strings and numbers

using YZ;

var text = "Value: 15";
var value = text.AsInt(min: 0, max: 100);
var rounded = 12.345.RoundTo(0.5);

JSON serialization

using YZ;

var user = new { userId = 7, userName = "Alice" };
var json = Helpers.JsonSerialize(user);
var clone = Helpers.JsonDeserializeWithDefault<User>(json, () => new User(0, "unknown"));
public record User(int userId, string userName);

Custom helper

using YZ;

string Encode(string text) => text.Md5();
var code = Encode("secret");

Sample JSON

{
  "user-id": 7,
  "user-name": "Alice"
}

API Reference

Attributes.cs

Classes: ToleranceAttribute, ConsoleColorAttribute, DeepCopyAttribute, EditableAttribute, BriefDescriptionAttribute, SuffixAttribute, SeverityAttribute, IsFatalAttribute, NormalizeAttribute

Member Type Description
Tolerance double TODO
Color ConsoleColor TODO
DeepCopy bool TODO
Editable bool TODO
BriefDescription string TODO
Suffix string TODO
Severity Severity TODO
IsFatal bool TODO
To double TODO
From double TODO
ToString() string TODO
ToString() string TODO
SeverityAttribute(Severity.NotError) readonly SeverityAttribute NotError = TODO
NormalizeTo( double value ) double TODO
NormalizeFrom( double value ) double TODO

Enums.cs

Enums: Severity, RussianCase, RussianCount, TimeUnit, LogPrefix, SpeedUnits

Helpers.App.cs

Classes: Helpers

Member Type Description
GetFullAppPath( this string relativePath ) string TODO

Helpers.Attributes.cs

Classes: Helpers

Member Type Description
GetAttr<TAttr>(this Type type, bool inherit, Func<TAttr> dflt = null) TAttr TODO
TValue>(this Type type, bool inherit, Func<TAttr, TValue> getValue, Func<TAttr> dflt = null) TValue GetAttr<TAttr, TODO
GetAttr<TAttr>(this object value, bool inherit, Func<object, TAttr> dflt = null) TAttr TODO
TValue>(this object value, bool inherit, Func<TAttr, TValue> getValue, Func<object, TAttr> dflt = null) TValue GetAttr<TAttr, TODO
TAttr>(this T value, bool inherit, Func<T, TAttr> dflt = null) TAttr GetAttr<T, TODO
TAttr>(this T value, bool inherit) TAttr[] GetAttrs<T, TODO
TAttr>(this T value, string propName, bool inherit, Func<T, string, TAttr> dflt = null) TAttr GetAttr<T, TODO
TAttr>(this T value, string propName, bool inherit) TAttr[] GetAttrs<T, TODO
TValue>(this T value, bool inherit, Func<TAttr, TValue> getValue) TValue[] GetAttrs<T, TAttr, TODO
TValue>(this T value, string propName, bool inherit, Func<TAttr, TValue> getValue) TValue[] GetAttrs<T, TField, TAttr, TODO
TValue>(this T value, bool inherit, Func<TAttr, TValue> getValue, Func<T, TAttr> dflt = null) TValue GetAttr<T, TAttr, TODO
TValue>(this T value, string propName, bool inherit, Func<TAttr, TValue> getValue, Func<T, string, TAttr> dflt = null) TValue GetAttr<T, TField, TAttr, TODO
GetDescription<TType>(this TType value, bool inherit = false) string TODO
GetBriefDescription<TType>(this TType value, bool inherit = false) string TODO
GetDescription<TType>(this TType value, GetDescriptionMode mode, bool inherit = false) string TODO
GetDescription<TType>(this TType value, string propName, bool inherit = false) string TODO
GetBriefDescription<TType>(this TType value, string propName, bool inherit = false) string TODO
GetDescription<TType>(this TType value, string propName, GetDescriptionMode mode, bool inherit = false) string TODO

Helpers.Compare.cs

Classes: GenericComparer, GenericEqualityComparer, GenericEqualityComparer

Member Type Description
Compare(T x, T y) int TODO
Equals(T x, T y) bool TODO
GetHashCode(T obj) int TODO
Equals(T x, T y) bool TODO
GetHashCode(T obj) int TODO

Helpers.Converters.cs

Classes: Helpers

Member Type Description
Not<T>(Func<T, bool> fn) Func<T, bool> TODO

Helpers.Encryption.cs

Classes: Helpers, Crypt

Member Type Description
Key string TODO
Md5(this string s) string TODO
GeneratePassword() string TODO
GenerateKey(int deep = 3) string TODO
Encrypt(byte[] data) byte[] TODO
Encrypt(string data) byte[] TODO
EncryptString(string data) string TODO
Decrypt(byte[] data) byte[] TODO
DecryptString(byte[] data) string TODO
DecryptString(string data) string TODO

Helpers.Enum.cs

Classes: Helpers

Member Type Description
ToTypes<TEnumType>() KeyValuePair<string, Dictionary<string, string>> TODO
EnumToArray<TEnumType>() TEnumType[] TODO
TResult>(Func<TEnumType, TResult> fn) TResult[] EnumToArray<TEnumType, TODO
TResult>(bool inherit, Func<TEnumType, TAttr, TResult> fn) TResult[] EnumToArray<TEnumType, TAttr, TODO
TResult>(Func<TEnumType, TResult> resFunc) Dictionary<TEnumType, TResult> EnumToDictionary<TEnumType, TODO
TResult>(bool inherit, Func<TAttr, TResult> resFunc, Func<TEnumType, TResult> dflt) Dictionary<TEnumType, TResult> EnumToDictionary<TEnumType, TAttr, TODO
ToKeyValuePairs<TEnumType>() Dictionary<TEnumType, string> TODO
TResult>(this TEnumType value, bool inherit, Func<TEnumType, TAttr, TResult> fn, Func<TEnumType, TAttr> dflt) TResult GetEnumAttr<TEnumType, TAttr, TODO
TAttr>(this TEnumType value, bool inherit, Func<TEnumType, TAttr> dflt = null) TAttr GetEnumAttr<TEnumType, TODO
TResult>(this TEnumType value, bool inherit, Func<TAttr, TResult> fn) TResult[] GetEnumAttrs<TEnumType, TAttr, TODO
TAttr>(this TEnumType value, bool inherit) TAttr[] GetEnumAttrs<TEnumType, TODO
Next<T>(this T value, out bool overflow, params T[] skipValues) T TODO
Prev<T>(this T value, out bool overflow, params T[] skipValues) T TODO
First<T>(this T value, params T[] skipValues) T TODO
Last<T>(this T value, params T[] skipValues) T TODO
Is<T>(this T value, params T[] allowed) bool TODO
GetEnumDescription<TEnum>(this TEnum value, GetDescriptionMode mode = GetDescriptionMode.Full) string TODO
GetEnumDescription(this Enum value, GetDescriptionMode mode = GetDescriptionMode.Full) string TODO
SafeCast<TEnum>(this string value, TEnum deflt = default, bool ignoreCase = false) TEnum TODO
SafeCast<TEnum>(this int value, TEnum deflt = default) TEnum TODO
SafeCast<TEnum>(this uint value, TEnum deflt = default) TEnum TODO
SafeCast<TEnum>(this byte value, TEnum deflt = default) TEnum TODO
SafeCast<TEnum>(this decimal? value, TEnum deflt = default) TEnum TODO

Helpers.Eval.cs

Classes: Helpers

Helpers.Exceptions.cs

Classes: Helpers

Member Type Description
GetInner(this Exception ex, int maxDepth = 5) IEnumerable<string> TODO
GetInner(this Exception ex, string separator, int maxDepth = 5) string TODO
GetInner<TException>(this Exception ex) TException TODO
GetInner(this Exception ex, Func<Exception, bool> selector) Exception TODO
TResult>(this TSource src, Func<TSource, TResult> fn) TResult SafeCall<TSource, TODO
TResult>(this TSource src, Func<TSource, TResult> fn, TResult dflt) TResult SafeCall<TSource, TODO
TResult>(this TSource src, Func<TSource, TResult> fn, TResult dflt, out Exception ex) TResult SafeCall<TSource, TODO
TResult>(this TSource src, Func<TSource, TResult> fn, Func<TResult> dflt) TResult SafeCall<TSource, TODO
TResult>(this TSource src, Func<TSource, TResult> fn, Func<TResult> dflt, out Exception ex) TResult SafeCall<TSource, TODO
SafeCall<TSource>(this TSource src, Action<TSource> fn) bool TODO
SafeCall<TSource>(this TSource src, Action<TSource> fn, out Exception ex) bool TODO
SafeCall(this Action fn) bool TODO
SafeCall(this Action fn, out Exception ex) bool TODO
SafeCall<TResult>(this Func<TResult> fn, out Exception ex, Func<TResult> dflt) TResult TODO
SafeCall<TResult>(this Func<TResult> fn, TResult dflt) TResult TODO
SafeCall<TResult>(this Func<TResult> fn, out Exception ex, TResult @default = default) TResult TODO

Helpers.Files.cs

Classes: Helpers

Member Type Description
GetPathEnding( this string path, int lastPathParts ) string TODO

Helpers.Geo.Angle.cs

Classes: AngleJsonConverter

Structs: Angle

Member Type Description
Degrees double TODO
Read( ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options ) Angle TODO
Write( Utf8JsonWriter writer, Angle angleValue, JsonSerializerOptions options ) void TODO
new(0) readonly Angle Zero = TODO
new(90) readonly Angle Deg90 = TODO
new(180) readonly Angle Deg180 = TODO
new(270) readonly Angle Deg270 = TODO
new(epsilon) readonly Angle Epsilon = TODO
FromDegrees( double deg ) Angle TODO
FromRadians( double rad ) Angle TODO
-( Angle a, Angle b ) Angle operator TODO
+( Angle a, Angle b ) Angle operator TODO
==( Angle a, Angle b ) bool operator TODO
!=( Angle a, Angle b ) bool operator TODO
<( Angle a, Angle b ) bool operator TODO
>( Angle a, Angle b ) bool operator TODO
IsSame( Angle b, Angle? maxDiff = null ) bool TODO
RoundTo( Angle step ) Angle TODO
Average( params Angle[] a ) Angle TODO
Average( params double[] a ) Angle TODO
Diff( Angle a, Angle b ) Angle TODO
Equals( object that ) bool TODO
GetHashCode() int TODO
ToString() string TODO
Parse( string s ) Angle TODO

Helpers.Geo.Coord.cs

Classes: GeoCoordJsonConverter

Structs: GeoCoord

Member Type Description
Read( ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options ) GeoCoord TODO
Write( Utf8JsonWriter writer, GeoCoord angleValue, JsonSerializerOptions options ) void TODO
==( GeoCoord a, GeoCoord b ) bool operator TODO
!=( GeoCoord a, GeoCoord b ) bool operator TODO
string( GeoCoord a ) implicit operator TODO
GeoCoord( string a ) implicit operator TODO
Constraint( GeoCoord? min = null, GeoCoord? max = null ) GeoCoord TODO
Parse( string latNon ) GeoCoord TODO
+( GeoCoord coord, GeoOffset offs ) GeoCoord operator TODO
-( GeoCoord coord, GeoOffset offs ) GeoCoord operator TODO
-( GeoCoord a, GeoCoord b ) GeoOffset operator TODO
&( GeoCoord a, GeoCoord b ) GeoCoord operator TODO
Average( GeoCoord[] a ) GeoCoord TODO
Approximate( GeoCoord a, GeoCoord b, double offs ) GeoCoord TODO
ToString() string TODO
Equals( object that ) bool TODO
GetHashCode() int TODO

Helpers.Geo.Distance.cs

Classes: GeoDistanceJsonConverter

Structs: GeoDistance

Member Type Description
CanConvert( Type objectType ) bool TODO
ReadJson( JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer ) object TODO
WriteJson( JsonWriter writer, object value, JsonSerializer serializer ) void TODO
/( GeoDistance a, double b ) GeoDistance operator TODO
/( GeoDistance a, TimeSpan b ) Speed operator TODO
*( GeoDistance a, double b ) GeoDistance operator TODO
+( GeoDistance a, GeoDistance b ) GeoDistance operator TODO
-( GeoDistance a, GeoDistance b ) GeoDistance operator TODO
-( GeoDistance a ) GeoDistance operator TODO
>( GeoDistance a, GeoDistance b ) bool operator TODO
<( GeoDistance a, GeoDistance b ) bool operator TODO
>=( GeoDistance a, GeoDistance b ) bool operator TODO
<=( GeoDistance a, GeoDistance b ) bool operator TODO
==( GeoDistance a, GeoDistance b ) bool operator TODO
!=( GeoDistance a, GeoDistance b ) bool operator TODO
FromMeters( double meters ) GeoDistance TODO
FromKm( double km ) GeoDistance TODO
GeoDistance(0) readonly GeoDistance Zero = TODO
CompareTo( GeoDistance other ) int TODO
double( GeoDistance d ) implicit operator TODO
GeoDistance( double meters ) implicit operator TODO
Equals( object obj ) bool TODO
GetHashCode() int TODO
ToString() string TODO

Helpers.Geo.GpsInfo.cs

Structs: GpsInfo

Member Type Description
OffsetTime( TimeSpan offset ) GpsInfo TODO
ToString() string TODO
Average( GpsInfo a, GpsInfo b ) GpsInfo TODO
Average( GpsInfo[] a ) GpsInfo TODO
Copy( GeoCoord? position = null, double? speed = null, double? acceleration = null, Angle? angle = null, bool? isValid = null, bool? isVirtual = null, DateTime? date = null, string label = null, TimeSpan? duration = null ) GpsInfo TODO
Approximate( [NotNull] GpsInfo[] a, DateTime t ) GpsInfo TODO
SplitBy( GpsInfo a, GpsInfo b, TimeSpan t ) IEnumerable<GpsInfo> TODO

Helpers.Geo.Helpers.cs

Classes: Helpers

Member Type Description
Sum( this IEnumerable<GeoDistance> distances ) GeoDistance TODO
Sum<T>( this IEnumerable<T> src, Func<T, GeoDistance> field ) GeoDistance TODO
MakePath( this IEnumerable<GeoLine> src ) IEnumerable<GeoCoord> TODO
GetViewport( this IEnumerable<GeoCoord> all ) GeoRect TODO
GetViewport( this IEnumerable<GeoRect> all ) GeoRect TODO

Helpers.Geo.Line.cs

Member Type Description
GetProjection( GeoCoord p ) GeoCoord TODO
IsProjected( GeoCoord p ) readonly bool TODO
DistanceTo( GeoCoord p ) readonly GeoDistance TODO
Translate( Angle a, GeoDistance d ) GeoLine TODO
Translate( GeoOffset offs ) GeoLine TODO
Scale( double b ) GeoLine TODO
Intersect( GeoLine b ) GeoCoord TODO
/( GeoLine a, double b ) GeoLine operator TODO
*( GeoLine a, double b ) GeoLine operator TODO
+( GeoLine a, GeoOffset b ) GeoLine operator TODO
-( GeoLine a, GeoOffset b ) GeoLine operator TODO
==( GeoLine a, GeoLine b ) bool operator TODO
!=( GeoLine a, GeoLine b ) bool operator TODO
&( GeoLine a, GeoLine b ) GeoCoord operator TODO
Equals( object obj ) bool TODO
Equals( GeoLine other ) bool TODO
GetHashCode() int TODO
ToString() string TODO

Helpers.Geo.Offset.cs

Structs: GeoOffset

Member Type Description
+( GeoOffset a, GeoOffset b ) GeoOffset operator TODO
+( GeoOffset a, Angle b ) GeoOffset operator TODO
+( GeoOffset a, GeoDistance b ) GeoOffset operator TODO
-( GeoOffset a ) GeoOffset operator TODO
*( GeoOffset a, double b ) GeoOffset operator TODO
/( GeoOffset a, double b ) GeoOffset operator TODO
*( GeoOffset a, (double xLat, double xLon) b ) GeoOffset operator TODO
GeoDistance( GeoOffset a ) implicit operator TODO
ToString() string TODO
CompareTo( GeoOffset other ) int TODO

Helpers.Geo.Rect.cs

Structs: GeoRect

Member Type Description
Combine( GeoRect other ) GeoRect TODO
ExpandTo( GeoCoord pt ) GeoRect TODO
Expand( GeoDistance d ) GeoRect TODO
Constraint( GeoOffset? min = null, GeoOffset? max = null, bool keepAspect = true ) GeoRect TODO
Scale( double xLat, double xLon ) GeoRect TODO
*( GeoRect a, (double xLat, double xLon) b ) GeoRect operator TODO
ConstraintMin( GeoOffset min, bool keepAspect = true ) GeoRect TODO
ConstraintMax( GeoOffset max, bool keepAspect = true ) GeoRect TODO
Equals( object obj ) bool TODO
Equals( GeoRect other ) bool TODO
GetHashCode() int TODO
ToString() string TODO
new(GeoCoord(), GeoCoord()) readonly GeoRect Empty = TODO

Helpers.Geo.Speed.cs

Classes: SpeedJsonConverter

Structs: Speed

Member Type Description
MetersPerSecond double TODO
Read( ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options ) Speed TODO
Write( Utf8JsonWriter writer, Speed speedValue, JsonSerializerOptions options ) void TODO
new(0) readonly Speed Zero = TODO
new(1) readonly Speed MS1 = TODO
FromKilometersPerHour(60) readonly Speed KmPH60 = TODO
FromKilometersPerHour(60) readonly Speed KmPH90 = TODO
new(epsilon) readonly Speed Epsilon = TODO
FromUnits( double value, SpeedUnits units = SpeedUnits.MetersPerSecond ) Speed TODO
FromMilesPerHour( double mph ) Speed TODO
FromMetersPerSecond( double metersPerSecond ) Speed TODO
FromKilometersPerHour( double kilometersPerHour ) Speed TODO
FromKnotsPerHour( double knotsPerHour ) Speed TODO
Speed( double a ) implicit operator TODO
-( Speed a, Speed b ) Speed operator TODO
+( Speed a, Speed b ) Speed operator TODO
==( Speed a, Speed b ) bool operator TODO
!=( Speed a, Speed b ) bool operator TODO
<( Speed a, Speed b ) bool operator TODO
>( Speed a, Speed b ) bool operator TODO
*( Speed a, TimeSpan b ) GeoDistance operator TODO
*( TimeSpan b, Speed a ) GeoDistance operator TODO
/( GeoDistance a, Speed b ) TimeSpan operator TODO
IsSame( Speed b, Speed? maxDiff = null ) bool TODO
RoundTo( Speed step ) Speed TODO
Average( params (Speed spd, GeoDistance dist)[] a ) Speed TODO
Average( params (Speed spd, TimeSpan time)[] a ) Speed TODO
Diff( Speed a, Speed b ) Speed TODO
Equals( object that ) bool TODO
GetHashCode() int TODO
ToString() string TODO
Parse( string src ) Speed TODO

Helpers.Geo.Tools.cs

Classes: Tools

Member Type Description
NormalizeDeg( double deg ) double TODO
ToEquator( double lat ) GeoDistance TODO
ToGreenwich( double lon ) GeoDistance TODO
Translate( GeoCoord coord, GeoOffset offs ) GeoCoord TODO
Intersect( GeoLine a, GeoLine b ) GeoCoord TODO

Helpers.Geometry.cs

Classes: Helpers

Structs: LineF

Member Type Description
Length double TODO
ScaleToFit(this Rectangle src, Rectangle bounds) Rectangle TODO
ScaleToFit(this Rectangle src, Size bounds) Rectangle TODO
ScaleToFit(this Rectangle src, int width, int height) Rectangle TODO
Translate(this Rectangle src, Point offs) Rectangle TODO
Translate(this Rectangle src, int x, int y) Rectangle TODO
Translate(this Point src, Point offs) Point TODO
Translate(this Point src, int x, int y) Point TODO
ScaleToFit(this RectangleF src, RectangleF bounds) RectangleF TODO
ScaleToFit(this RectangleF src, Size bounds) RectangleF TODO
ScaleToFit(this RectangleF src, float width, float height) RectangleF TODO
Translate(this RectangleF src, PointF offs) RectangleF TODO
Translate(this RectangleF src, float x, float y) RectangleF TODO
Translate(this PointF src, PointF offs) PointF TODO
Translate(this PointF src, float x, float y) PointF TODO
Contains(PointF p, bool strict = true) bool TODO
IsInside(this PointF pt, IEnumerable<PointF> shape) bool TODO

Helpers.Guid.cs

Classes: Helpers

Member Type Description
IsEmptyOrSame(this Guid guid, Guid target) bool TODO

Helpers.Http.cs

Classes: Helpers

Member Type Description
GetJsonAsync<T>(this HttpClient http, string host, CancellationToken cancellationToken, params (string key, object value)[] args) Task<T> TODO
GetJsonAsync<T>(this HttpClient http, string host, string path, CancellationToken cancellationToken, params (string key, object value)[] args) Task<T> TODO

Helpers.Lists.cs

Classes: Helpers, ConcurrentDictionary, ConcurrentDictionary, FolderTree, Folder, Item

Member Type Description
ToString<T>( this ICollection<T> arr, string separator ) string TODO
ToString<T>( this IEnumerable<T> arr, string separator ) string TODO
ToString<T>( this IEnumerable<T> arr, string separator, Func<T, object> convert ) string TODO
ToString<T>( this IEnumerable<T> arr, string separator, string openTag, string closeTag ) string TODO
ToString( this IEnumerable<byte> arr, string separator = "", string format = "x2" ) string TODO
ToBase64String( this IEnumerable<byte> arr ) string TODO
ToBase64String( this byte[] arr ) string TODO
ToString<TValue>( this Dictionary<string, TValue> arr, string separator, string kvSeparator ) string TODO
ForEach<T>( this IEnumerable<T> src, Action<T> fn ) IEnumerable<T> TODO
ToArray<T>( this IEnumerable<T> src, int size, Func<T, int> index ) T[] TODO
TDest>( this IEnumerable<T> src, int size, Func<T, int> index, Func<T, TDest> convert ) TDest[] ToArray<T, TODO
TValue>() Func<KeyValuePair<TKey, TValue>, TKey> KeyFn<TKey, TODO
TValue>() Func<KeyValuePair<TKey, TValue>, TValue> ValueFn<TKey, TODO
Fill<T>( this T[] src, T value, int start = 0, int count = 0 ) void TODO
Nearest<T>( this IEnumerable<T> src, T value, Func<T, T, decimal> distance, [CallerArgumentExpression( nameof( src ) )] string expr = "" ) T TODO
Nearest<T>( this IEnumerable<T> src, T value, Func<T, T, uint> distance, [CallerArgumentExpression( nameof( src ) )] string expr = "" ) T TODO
Nearest<T>( this IEnumerable<T> src, Func<T, decimal> distance, [CallerArgumentExpression( nameof( src ) )] string expr = "" ) T TODO
Nearest<T>( this IEnumerable<T> src, Func<T, uint> distance, [CallerArgumentExpression( nameof( src ) )] string expr = "" ) T TODO
TDiff>( this T[] src, TProp value, Func<T, TProp> fld, Func<TProp, TProp, TDiff> diff ) int NearestIndex<T, TProp, TODO
SplitBy<T>( this IEnumerable<T> src, int size ) IEnumerable<IEnumerable<T>> TODO
Generate<T>( this int count, Func<int, T> generator ) T[] TODO
Shuffle<T>( this IEnumerable<T> src ) IEnumerable<T> TODO
TValue>( this IEnumerable<KeyValuePair<TKey, TValue>> src ) Dictionary<TKey, TValue> ToDictionary<TKey, TODO
AddOrUpdate( TKey key, TSubKey subkey, TSubSubKey subsubkey, Func<TKey, TSubKey, TSubSubKey, TValue> addValueFactory, Func<TKey, TSubKey, TSubSubKey, TValue, TValue> updateValueFactory ) TValue TODO
TryGetValue( TKey key, TSubKey subkey, TSubSubKey subsubkey, out TValue value ) bool TODO
TryAdd( TKey key, TSubKey subkey, TSubSubKey subsubkey, TValue value ) bool TODO
TryRemove( TKey key, TSubKey subkey, TSubSubKey subsubkey, out TValue value ) bool TODO
AddOrUpdate( TKey key, TSubKey subkey, Func<TKey, TSubKey, TValue> addValueFactory, Func<TKey, TSubKey, TValue, TValue> updateValueFactory ) TValue TODO
TryGetValue( TKey key, TSubKey subkey, out TValue value ) bool TODO
TryAdd( TKey key, TSubKey subkey, TValue value ) bool TODO
TryRemove( TKey key, TSubKey subkey, out TValue value ) bool TODO
ToList<T>( Func<TKey, TSubKey, TValue, T> convert ) List<T> TODO
ForEach( Action<TKey, TSubKey, TValue> fn ) void TODO
ForEach( TKey key, Action<TKey, TSubKey, TValue> fn ) void TODO
ForEach( IEnumerable<TKey> keys, Action<TKey, TSubKey, TValue> fn ) void TODO
ForEach( IEnumerable<TKey> keys, IEnumerable<TSubKey> subKeys, Action<TKey, TSubKey, TValue> fn ) void TODO

Helpers.Logs.cs

Classes: LogStorage, Item, LoggerClient

Structs: Dto

Enums: Verbosity

Member Type Description
Prefix string TODO
Verbosity Verbosity TODO
FileWriteVerbosity Verbosity TODO
Verbosity Verbosity TODO
Prefix string TODO
Index ulong TODO
Date DateTime TODO
Message string TODO
ILoggerClient interface TODO
Storage LogStorage TODO
Prefix string TODO
ConsoleColor>(true, resFunc: a) readonly Dictionary<Verbosity, ConsoleColor> VerbosityConsoleColors = Helpers.EnumToDictionary<Verbosity, ConsoleColorAttribute, TODO
string>(true, resFunc: a) readonly Dictionary<Verbosity, string> VerbosityDescriptions = Helpers.EnumToDictionary<Verbosity, DescriptionAttribute, TODO
DefaultLogEvent( LogStorage sender, Item message ) void TODO
LogEvent( LogStorage sender, Item message ) delegate void TODO
GetItems( ulong startFromId ) List<Item.Dto> TODO
GetItemsError( string err ) List<Item.Dto> TODO
Log( string s, Verbosity v = Verbosity.Info, string prefix = "" ) void TODO
Error( Exception ex, Verbosity v = Verbosity.Error, string prefix = "" ) void TODO
Error( string s, Verbosity v = Verbosity.Error, string prefix = "" ) void TODO
Dispose() void TODO
Log( string s, Verbosity v = Verbosity.Info, string prefix = "", [CallerMemberName] string callerName = "", [CallerFilePath] string file = "", [CallerLineNumber] int line = -1 ) void TODO
Hint( string s, string prefix = "", [CallerMemberName] string callerName = "", [CallerFilePath] string file = "", [CallerLineNumber] int line = -1 ) void TODO
Info( string s, string prefix = "", [CallerMemberName] string callerName = "", [CallerFilePath] string file = "", [CallerLineNumber] int line = -1 ) void TODO
Warning( string s, string prefix = "", [CallerMemberName] string callerName = "", [CallerFilePath] string file = "", [CallerLineNumber] int line = -1 ) void TODO
Fatal( string s, string prefix = "", [CallerMemberName] string callerName = "", [CallerFilePath] string file = "", [CallerLineNumber] int line = -1 ) void TODO
Critical( string s, string prefix = "", [CallerMemberName] string callerName = "", [CallerFilePath] string file = "", [CallerLineNumber] int line = -1 ) void TODO
Important( string s, string prefix = "", [CallerMemberName] string callerName = "", [CallerFilePath] string file = "", [CallerLineNumber] int line = -1 ) void TODO
Error( Exception ex, Verbosity v = Verbosity.Error, string prefix = "", [CallerMemberName] string callerName = "", [CallerFilePath] string file = "", [CallerLineNumber] int line = -1 ) void TODO
Error( string s, Verbosity v = Verbosity.Error, string prefix = "", [CallerMemberName] string callerName = "", [CallerFilePath] string file = "", [CallerLineNumber] int line = -1 ) void TODO
InfoTemp( string s, string prefix = "", [CallerMemberName] string callerName = "", [CallerFilePath] string file = "", [CallerLineNumber] int line = -1 ) void TODO
Dispose() void TODO

Helpers.Network.cs

Classes: Helpers

Member Type Description
NormalizeIp(this string ip, string deflt = "127.0.0.1") string TODO
NormalizeMac(this string mac, string deflt = null) string TODO
GetLocalIp(AddressFamily addressFamily = AddressFamily.InterNetwork) IPAddress TODO
GetLocalIpAddress(AddressFamily addressFamily = AddressFamily.InterNetwork) string TODO

Helpers.Numbers.cs

Classes: Helpers

Member Type Description
Convert(this int value, char[] digits) string TODO
RoundTo(this double x, double step) double TODO
RoundTo(this double x, double step, int decimals) double TODO
RoundTo(this decimal x, decimal step) decimal TODO
InRange(this int x, int min, int max) bool TODO
InRange(this double x, double min, double max) bool TODO
InRange<T>(this T x, T min, T max) bool TODO
Constraint<T>(this T src, T? min = null, T? max = null, T? outrangeDefault = null) T TODO
Constraint<T>(this T src, (T min, T max) minmax, T? outrangeDefault = null) T TODO
Constraint<T>(this T src, T min = null, T max = null, T outrangeDefault = null) T TODO
Constraint<T>(this T src, (T min, T max) minmax, T outrangeDefault = null) T TODO
ToString(this double value, double roundTo, string e0, string e1, string e2) string TODO
ToString(this int value, string e0, string e1, string e2) string TODO
ToBytesNative(this int value, params string[] suffix) string TODO
ToBytesNative(this uint value, params string[] suffix) string TODO
ToBytesNative(this long value, params string[] suffix) string TODO
ToBytesNative(this ulong value, params string[] suffix) string TODO
ToBytesNative(this double value, params string[] suffix) string TODO

Helpers.Objects.cs

Classes: Helpers

Member Type Description
ListEqual(this IList src, IList dst, bool deep) bool TODO
DictionaryEqual(this IDictionary src, IDictionary dst, bool deep) bool TODO
ObjectEqual(this object src, object dst) bool TODO

Helpers.Range.cs

Classes: Helpers, Range, Range, LongRange

Member Type Description
Start T TODO
Stop T TODO
Recombine<T>(this IEnumerable<Range<T>> src) IEnumerable<Range<T>> TODO
T2>(this IEnumerable<T2> src, Func<Range<T>, T2> convert) IEnumerable<T2> Recombine<T, TODO
Sum(this IEnumerable<DateRange> src) TimeSpan TODO
Sum(this IEnumerable<Range<DateTime>> src) TimeSpan TODO
CompareTo(Range<T> other) int TODO
Equals(Range<T> other) bool TODO
ToString() string TODO
ToString(string separator) string TODO
ToString(string format, IFormatProvider formatProvider) string TODO
Parse(string s, Func<string, T> convert, T dflt = default, string separator = "-") Range<T> TODO
ToList(Func<T, T> succ) List<T> TODO
ToList() List<T> TODO
CombineWith(Range<T> other) Range<T> TODO
IntersectWith(Range<T> other) Range<T> TODO
IntersectsWith(Range<T> other) bool TODO
FullyContains(Range<T> other) bool TODO
Contains(T other) bool TODO
Constraint(T min, T max) Range<T> TODO
Constraint(Range<T> limit) Range<T> TODO
Expand(T start, T stop) Range<T> TODO
Expand(Range<T> other) Range<T> TODO
Range<T>(T src) implicit operator TODO
Sort(IEnumerable<Range<T>> src) IEnumerable<Range<T>> TODO
Add(params Range<T>[] items) IEnumerable<Range<T>> TODO
Add(T item) IEnumerable<Range<T>> TODO
As<TDest>() TDest TODO
Subtract(Range<T> other) IEnumerable<Range<T>> TODO
Subtract(T item) IEnumerable<Range<T>> TODO
Subtract(params Range<T>[] items) IEnumerable<Range<T>> TODO
==(Range<T> a, Range<T> b) bool operator TODO
!=(Range<T> a, Range<T> b) bool operator TODO
+(Range<T> a, IEnumerable<Range<T>> b) IEnumerable<Range<T>> operator TODO
+(Range<T> a, Range<T> b) IEnumerable<Range<T>> operator TODO
+(Range<T> a, T b) IEnumerable<Range<T>> operator TODO
-(Range<T> a, IEnumerable<Range<T>> b) IEnumerable<Range<T>> operator TODO
-(Range<T> a, Range<T> b) IEnumerable<Range<T>> operator TODO
-(Range<T> a, T b) IEnumerable<Range<T>> operator TODO
*(Range<T> a, Range<T> b) Range<T> operator TODO
GetHashCode() int TODO
Recombine<T2>(IEnumerable<T2> src, Func<Range<T>, T2> convert) IEnumerable<T2> TODO
Recombine(IEnumerable<Range<T>> src) IEnumerable<Range<T>> TODO
Equals(object obj) bool TODO
<(Range<T> left, Range<T> right) bool operator TODO
<=(Range<T> left, Range<T> right) bool operator TODO
>(Range<T> left, Range<T> right) bool operator TODO
>=(Range<T> left, Range<T> right) bool operator TODO
ConvertTo(Func<T, TDest> converter) Range<TDest> TODO
ConvertTo() Range<T> TODO
ConvertFrom(Range<TDest> src, Func<TDest, T> converter) Range<T, TDest> TODO
TDest>(T src) implicit operator Range<T, TODO
ToList() List<int> TODO
Recombine(params int[] value) IntRange[] TODO
Recombine(IEnumerable<IntRange> values) IntRange[] TODO
TakeFirst(out IEnumerable<IntRange> left) int TODO
Random() int TODO
TakeRandom(out IEnumerable<IntRange> left) int TODO
ExtractFirst() int TODO
ToList() List<IntRange> TODO
Add(int item) void TODO
AddRange(IntRange t) void TODO
ExtractRandom() int TODO
IntRangeSet(IntRange[] src) implicit operator TODO
IntRangeSet(List<IntRange> src) implicit operator TODO
DateRange(DateTime src) implicit operator TODO
FullMonthFromDate(DateTime src) DateRange TODO
Expand(TimeSpan margin) DateRange TODO
Equals(DateRange b, TimeSpan epsilon) bool TODO
SplitByDay() DateRange[] TODO
SplitByMonth() DateRange[] TODO
SplitByYear() DateRange[] TODO
SplitByHour() DateRange[] TODO
SplitByHalfHour() DateRange[] TODO
SplitByQuarterHour() DateRange[] TODO
SplitByPoints(IEnumerable<DateTime> pts) IEnumerable<DateRange> TODO

Helpers.Serialize.cs

Classes: Helpers

Member Type Description
JsonDeserializeWithDefault<T>(string s, Func<T> deflt = null) T TODO
JsonDeserializeToAny(string s) object TODO
JsonSerialize(object v) string TODO

Helpers.Strings.cs

Classes: Helpers

Member Type Description
Params(this string template, params object[] parms) string TODO
AsInt(this string s, int? min = null, int? max = null, int? outrangeDefault = null) int TODO
AsLong(this string s, long? min = null, long? max = null, long? outrangeDefault = null) long TODO
AsDouble(this string s, double? min = null, double? max = null, double? outrangeDefault = null) double TODO
AsBool(this string s, params string[] trueValues) bool TODO
AsBool(this string s, bool deflt) bool TODO
AsBool(this string s) bool? TODO
FromHex(this string s) int TODO
ToString(this bool? b, string trueValue, string falseValue, string nullValue = null) string TODO
ToString(this bool b, string trueValue, string falseValue) string TODO
Repeat(this string s, int count) string TODO
Ellipsis(this string s, int maxLength) string TODO

Helpers.Time.cs

Classes: Helpers

Enums: OffsetTimeUnit

Member Type Description
DateTime(2001, 01, 01) readonly DateTime Jan2001 = TODO
TrimSeconds(this DateTime d) DateTime TODO
DateTime(1970, 01, 01, 0, 0, 0, DateTimeKind.Utc) readonly DateTime Year1970Start = TODO
DateTime(2000, 01, 01, 0, 0, 0, DateTimeKind.Utc) readonly DateTime Year2000Start = TODO
DateTime(2020, 01, 01, 0, 0, 0, DateTimeKind.Utc) readonly DateTime Year2020Start = TODO
ToOffsetTimeUnits(this TimeSpan t, OffsetTimeUnit mode) long TODO
FromJan(this DateTime d, DateTime startOfYear, OffsetTimeUnit mode) long TODO
FromJan1970(this DateTime d, OffsetTimeUnit mode) long TODO
FromJan2000(this DateTime d, OffsetTimeUnit mode) long TODO
FromJan2020(this DateTime d, OffsetTimeUnit mode) long TODO
ToOffsetTimeUnits(this long t, OffsetTimeUnit mode) TimeSpan TODO
FromJan(this long units, DateTime startOfYear, OffsetTimeUnit mode) DateTime TODO
FromJan1970(this long units, OffsetTimeUnit mode) DateTime TODO
FromJan2000(this long units, OffsetTimeUnit mode) DateTime TODO
FromJan2020(this long units, OffsetTimeUnit mode) DateTime TODO
FromUnixTimestamp(this long seconds) DateTime TODO
ToUnixTimestamp(this DateTime time) long TODO
GetMinuteId(this DateTime d) long TODO
GetSecondId(this DateTime d) long TODO
FromMinuteId(this long d) DateTimeOffset TODO
FromSecondId(this long d) DateTimeOffset TODO
GetOffsetFromGMTString(this string tz) TimeSpan TODO
AsOffsetForDateTimeOffset(this TimeSpan offset) string TODO
AsInt(this DayOfWeek dow) int TODO
Constraint(this DateTime src, DateTime? min = null, DateTime? max = null, DateTime? outrangeDefault = null) DateTime TODO
Constraint(this TimeSpan src, TimeSpan? min = null, TimeSpan? max = null, TimeSpan? outrangeDefault = null) TimeSpan TODO
Constraint(this DateTime src, DateTime min) DateTime TODO
Constraint(this TimeSpan src, TimeSpan min) TimeSpan TODO
Sum(this IEnumerable<TimeSpan> src) TimeSpan TODO
Sum<T>(this IEnumerable<T> src, Func<T, TimeSpan> select) TimeSpan TODO
Age(this DateTime date) double TODO
IsToday(this DateTime d) bool TODO
IsCurrentWeek(this DateTime d) bool TODO
IsCurrentMonth(this DateTime d) bool TODO
IsCurrentYear(this DateTime d) bool TODO
IsWeekend(this DateTime d) bool TODO
RoundMinutes(this DateTime src, double minutes) DateTime TODO
NearestHour(this DateTime src) DateTime TODO
Constraint(this TimeSpan src) TimeSpan TODO
ToHoursMinutes(this TimeSpan t, bool ignoreNegative = false) string TODO
ToHoursMinutes2(this TimeSpan t, bool ignoreNegative = false) string TODO
StartOfWeek(this DateTime src) DateTime TODO
LastDayOfWeek(this DateTime src) DateTime TODO
EndOfWeek(this DateTime src) DateTime TODO
StartOfMonth(this DateTime src) DateTime TODO
EndOfMonth(this DateTime src) DateTime TODO
LastDayOfMonth(this DateTime src) DateTime TODO
StartOfYear(this DateTime src) DateTime TODO
EndOfYear(this DateTime src) DateTime TODO
LastDayOfYear(this DateTime src) DateTime TODO
StartOfHour(this DateTime src, double addHours = 0) DateTime TODO
EndOfHour(this DateTime src, double addHours = 0) DateTime TODO
StartOfNthHour(this DateTime src, int n, double addHours = 0) DateTime TODO
EndOfNthHour(this DateTime src, int n, double addHours = 0) DateTime TODO
StartOfHalfHour(this DateTime src, double addHours = 0) DateTime TODO
EndOfHalfHour(this DateTime src, double addHours = 0) DateTime TODO
StartOfQuarterHour(this DateTime src, double addHours = 0) DateTime TODO
EndOfQuarterHour(this DateTime src, double addHours = 0) DateTime TODO
StartOfMinute(this DateTime src, double addMinutes = 0) DateTime TODO
EndOfMinute(this DateTime src, double addMinutes = 0) DateTime TODO
IsYesterday(this DateTime src, int offset = 1) bool TODO
IsTomorrow(this DateTime src, int offset = 1) bool TODO
ToNativeDate(this DateTime src, string timeFormat = null) string TODO
ToNativeDateShort(this DateTime src) string TODO
ToFriendlyString(this TimeSpan ts, RussianCase rc = RussianCase.Nominative) string TODO

Helpers.Types.cs

Classes: Helpers

Helpers.Uri.cs

Classes: Helpers

Member Type Description
ReplaceHost(this Uri uri, string host) Uri TODO
IsValidIpV4(this string ip) bool TODO

Helpers.Video.cs

Classes: Helpers

Member Type Description
Yuv12ToRgb(IntPtr srcPtr, int w, int h, ref byte[] dst, out int stride) void TODO

Options.cs

Classes: OptionValueCollection, OptionContext, OptionException, OptionSet

Enums: OptionValueType

Member Type Description
Count int TODO
IsReadOnly bool TODO
Option Option TODO
OptionName string TODO
OptionIndex int TODO
OptionSet OptionSet TODO
OptionValues OptionValueCollection TODO
Prototype string TODO
Description string TODO
OptionValueType OptionValueType TODO
MaxValueCount int TODO
OptionName string TODO
Add(string item) void TODO
Clear() void TODO
Contains(string item) bool TODO
CopyTo(string[] array, int arrayIndex) void TODO
Remove(string item) bool TODO
GetEnumerator() IEnumerator<string> TODO
IndexOf(string item) int TODO
Insert(int index, string item) void TODO
RemoveAt(int index) void TODO
ToList() List<string> TODO
ToArray() string[] TODO
ToString() string TODO
GetNames() string[] TODO
GetValueSeparators() string[] TODO
Invoke(OptionContext c) void TODO
ToString() string TODO
GetObjectData(SerializationInfo info, StreamingContext context) void TODO
TValue>(TKey key, TValue value) delegate void OptionAction<TKey, TODO
Add(Option option) OptionSet TODO
Add(string prototype, Action<string> action) OptionSet TODO
Add(string prototype, string description, Action<string> action) OptionSet TODO
Add(string prototype, OptionAction<string, string> action) OptionSet TODO
Add(string prototype, string description, OptionAction<string, string> action) OptionSet TODO
Add<T>(string prototype, Action<T> action) OptionSet TODO
Add<T>(string prototype, string description, Action<T> action) OptionSet TODO
TValue>(string prototype, OptionAction<TKey, TValue> action) OptionSet Add<TKey, TODO
TValue>(string prototype, string description, OptionAction<TKey, TValue> action) OptionSet Add<TKey, TODO
Parse(IEnumerable<string> arguments) List<string> TODO
Parse(IEnumerable<string> arguments) List<string> TODO
WriteOptionDescriptions(TextWriter o) void TODO
WriteOptionDescriptions(Action<string> line) void TODO

Program.Base.Logs.cs

Program.Base.cs

Validate.Email.cs

Classes: Email

Member Type Description
FilterEmail(this string email) string TODO
Filter(string email) string TODO
IsValidEmail(this string s) bool TODO
IsValid(string s) bool TODO

Validate.Phone.cs

Classes: Phone

Member Type Description
CountryCode string TODO
AreaCode string TODO
Number string TODO
Format(string phone, bool format) string TODO
Clear() void TODO
Parse(string s) void TODO
ToString(bool format) string TODO
ToString() string TODO

License

MIT

Product 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.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
1.0.59 657 9/15/2025
1.0.58 208 9/7/2025
1.0.56 281 8/27/2025
1.0.55 159 8/23/2025
1.0.53 259 1/23/2025
1.0.52 229 1/23/2025
1.0.51 227 1/22/2025
1.0.48 264 7/1/2024
1.0.46 237 8/17/2023
1.0.44 277 7/5/2023
1.0.43 252 5/30/2023
1.0.42 453 1/11/2023
1.0.41 415 1/11/2023
1.0.40 617 1/30/2022
1.0.39 3,756 11/25/2021
1.0.38 457 11/5/2021
1.0.37 495 10/18/2021
1.0.36 468 9/28/2021
1.0.34 459 9/6/2021
1.0.33 471 9/6/2021
Loading failed