ArjaiSolutions.ExtensionLibrary 1.0.17

.NET Standard 2.1
There is a newer version of this package available.
See the version list below for details.
dotnet add package ArjaiSolutions.ExtensionLibrary --version 1.0.17
NuGet\Install-Package ArjaiSolutions.ExtensionLibrary -Version 1.0.17
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="ArjaiSolutions.ExtensionLibrary" Version="1.0.17" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ArjaiSolutions.ExtensionLibrary --version 1.0.17
#r "nuget: ArjaiSolutions.ExtensionLibrary, 1.0.17"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install ArjaiSolutions.ExtensionLibrary as a Cake Addin
#addin nuget:?package=ArjaiSolutions.ExtensionLibrary&version=1.0.17

// Install ArjaiSolutions.ExtensionLibrary as a Cake Tool
#tool nuget:?package=ArjaiSolutions.ExtensionLibrary&version=1.0.17

ArJaiSolutions Extension Library

ArJaiSolutions extension library contains some basic extensions for string, Objects and Mainly extension for Iquerable to create dynamic expressions.

Dictionary Extensions

DictionaryExtensions.TryReturnValue<TKey, TValue>(System.Collections.Generic.IDictionary<TKey, TValue>, TKey, TValue)

To fetch the value directly from the dictionary for the provided key. else return the default value

String Extensions

string.ToBool()

Converts string to bool if not able to convert, It will return null. Possible values from string to bool are true/false, 0/1,yes/no, y/n.

string.ToBool(bool)

Converts string to bool if not able to convert, It will return the default value provided or false. Possible values from string to bool are true/false, 0/1,yes/no, y/n

string.ToDateTime(string, string)

Converts the given string to Datetime based on the format and culture provided or by Default the format is "ddMMyyyy" and culture is "en-GB"

string.ToDateTime(string, System.Globalization.CultureInfo)

Converts the given string to Datetime based on the format and culture provided

string.ToGuid(string)

Converts Given string and guid formats default guid format ='D' Guid formats can be - "N","D","B","P","X"

string.ToInt()

Converts this string to int if unable to convert it returns null

string.ToInt(int)

Converts this string to int if unable to convert it returns the default number Or 0 (if no default provided)

string.Tolong()

Converts this string to long if unable to convert it returns null

string.Tolong(long)

Converts this string to long if unable to convert it returns the default number Or 0 (if no default provided)

string.ToUTCDateTime()

Converts the given string to UTCDatetime

string.ToEnum<T>()

Converts string to any Enum of the Type "T"

string.ToEnum<T>(T defaultValue)

Converts string to any Enum of the Type "T", with an default value of the Enum

Object Extensions

Object.ConvertToTheGivenType(System.Type)

Converts the object provided to the given type → Except: DateTime - Which is converted to UTCDateTime , bool - Which is converted to bool from (true/false, 0/1, yes/no, y/n)

string.ToBool()

Converts string to bool if not able to convert, It will return null. Possible values from string to bool are true/false, 0/1,yes/no, y/n.

string.ToBool(bool)

Converts string to bool if not able to convert, It will return the default value provided or false. Possible values from string to bool are true/false, 0/1,yes/no, y/n

string.ToInt()

Converts this string to int if unable to convert it returns null

string.ToInt(int)

Converts this string to int if unable to convert it returns the default number Or 0 (if no default provided)

string.Tolong()

Converts this string to long if unable to convert it returns null

string.Tolong(long)

Converts this string to long if unable to convert it returns the default number Or 0 (if no default provided)

Queryable Extensions

IQueryable.PreadicateConditionBasedFiltering<TSource>(System.Linq.IQueryable<TSource>, string, ExtensionLibrary.PreadicateConditions, object)

To create expression for a source with the property and input value based on the condition provided

Exceptions: "ArgumentOutOfRangeException" if the input value is not been able to convert to the same type of the property

QueryableExtensions.GetNavigationPropertyExpression(System.Linq.Expressions.Expression, ExtensionLibrary.PreadicateConditions, object, string[])

Creates an expression for the property in the path provided. You could have an expression created for a sub properties child property e.g. object school has a property of students and you want to get a expression where students have their firstname started with 'A', you need to call this method with expression parameter which means x=> which you can make by doing Expression.Paramter(type(ParentElement),"x") (in our case parent element is school) once you have a parameter set up then call GetNavigationPropertyExpression(parameter,preadicatecondition.condition, "A","students","firstname");

Helpers for Queryable Expression building

QueryableExtensions.GreaterThan<TSource>(System.Linq.IQueryable<TSource>, System.Linq.Expressions.ParameterExpression, System.Linq.Expressions.Expression, System.Linq.Expressions.Expression)

Returns the Expression of "GreaterThan" for the source based on the property and target an example of what is build and returned e.g. (parameter ⇒ parameter.property>target) where parameter is of the type source

QueryableExtensions.GreaterThanOrEqualTo<TSource>(System.Linq.IQueryable<TSource>, System.Linq.Expressions.ParameterExpression, System.Linq.Expressions.Expression, System.Linq.Expressions.Expression, bool)

Returns the Expression of "GreaterThan" for the source based on the property and target an example of what is build and returned e.g. (parameter ⇒ parameter.property>=target) where parameter is of the type source

QueryableExtensions.LessThan<TSource>(System.Linq.IQueryable<TSource>, System.Linq.Expressions.ParameterExpression, System.Linq.Expressions.Expression, System.Linq.Expressions.Expression)

Returns the Expression of "LessThan" for the source based on the property and target an example of what is build and returned e.g. (parameter ⇒ parameter.property<target) where parameter is of the type source

QueryableExtensions.LessThanOrEqualTo<TSource>(System.Linq.IQueryable<TSource>, System.Linq.Expressions.ParameterExpression, System.Linq.Expressions.Expression, System.Linq.Expressions.Expression, bool)

Returns the Expression of "LessThanOrEqual" for the source based on the property and target an example of what is build and returned e.g. (parameter ⇒ parameter.property=<target) where parameter is of the type source

QueryableExtensions.NotEqual<TSource>(System.Linq.IQueryable<TSource>, System.Linq.Expressions.ParameterExpression, System.Linq.Expressions.Expression, System.Linq.Expressions.Expression)

Returns the Expression of "NotEqual" for the source based on the property and target an example of what is build and returned e.g. (parameter ⇒ parameter.property!=target) where paramter is of the type source

QueryableExtensions.MakePreadicateCondition(ExtensionLibrary.PreadicateConditions, System.Linq.Expressions.Expression, System.Linq.Expressions.Expression)

this method makes an Expression for Preadicate Condition.

Preadicate conditions Enum

/// Equals (=) Equals,

/// Equals (!=) NotEqual,

/// Contains as in Type.Contains() Contains,

/// GreaterThan (>) GreaterThan,

/// GreaterThanOrEqual (>=) GreaterThanOrEqual,

/// LessThan (<) LessThan,

/// LessThan (=<) LessThanOrEqual,

/// StartsWith like Type.StartsWith() StartsWith,

/// EndsWith like Type.EndsWith() EndsWith

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
.NET Core netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.1
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen 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

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.27 788 3/24/2022
1.0.26 224 3/15/2022
1.0.25 1,336 3/10/2021
1.0.23 530 1/21/2021
1.0.22 440 12/2/2020
1.0.21 586 9/18/2020
1.0.20 619 7/29/2020
1.0.19 636 6/5/2020
1.0.18 841 5/11/2020
1.0.17 896 4/6/2020