![]() |
VOOZH | about |
dotnet add package ExpressionDelegates.Base --version 1.0.0
NuGet\Install-Package ExpressionDelegates.Base -Version 1.0.0
<PackageReference Include="ExpressionDelegates.Base" Version="1.0.0" />
<PackageVersion Include="ExpressionDelegates.Base" Version="1.0.0" />Directory.Packages.props
<PackageReference Include="ExpressionDelegates.Base" />Project file
paket add ExpressionDelegates.Base --version 1.0.0
#r "nuget: ExpressionDelegates.Base, 1.0.0"
#:package ExpressionDelegates.Base@1.0.0
#addin nuget:?package=ExpressionDelegates.Base&version=1.0.0Install as a Cake Addin
#tool nuget:?package=ExpressionDelegates.Base&version=1.0.0Install as a Cake Tool
API is very simple:
ExpressionDelegates.Accessors.Find(string signature).Getter(object targetObject)
ExpressionDelegates.Accessors.Find(MemberInfo member).Setter(object targetObject, object value)
ExpressionDelegates.Methods.Find(string signature).Invoke(object targetObject, params object[] args)
ExpressionDelegates.Methods.Find(MethodInfo method).Invoke(object targetObject, params object[] args)
ExpressionDelegates.Constructors.Find(string signature ).Invoke(params object[] args)
ExpressionDelegates.Constructors.Find(Constructors constructor).Invoke(params object[] args)
Expression<Func<string, int>> expression = s => s.Length;
MemberInfo accessorInfo = ((MemberExpression)expression.Body).Member;
Accessor lengthAccessor = ExpressionDelegates.Accessors.Find(accessorInfo);
// or
lengthAccessor = ExpressionDelegates.Accessors.Find("System.String.Length");
var value = lengthAccessor.Get("17 letters string");
// value == 17
If property/field is read-only, Accessor.Set will be null.
If property is write-only, Accessor.Get will be null.
Expression<Func<string, char, bool>> expression = (s, c) => s.Contains(c);
MethodInfo methodInfo = ((MethodCallExpression)expression.Body).Method;
Method containsMethod = ExpressionDelegates.Methods.Find(methodInfo);
// or
containsMethod = ExpressionDelegates.Methods.Find("System.String.Contains(System.Char)");
var value = containsMethod.Invoke("Hello", 'e');
// value == true
Expression<Func<char, int, string>> expression = (c, i) => new string(c, i);
ConstructorInfo ctorInfo = ((NewExpression)expression.Body).Constructor;
Constructor stringCtor = ExpressionDelegates.Constructors.Find(ctorInfo);
// or
stringCtor = ExpressionDelegates.Constructors.Find("System.String.String(System.Char, System.Int32)");
var value = stringCtor.Invoke('c', 5);
// value == "ccccc"
Parameters for the delegates, their count and type checking are up to you. InvalidCastException is thrown in case of using wrong parameters for a delegate signature. IndexOutOfRangeException is thrown for an unexpected parameter count.
No delegates for private or protected classes and members, only for internal and public
No delegates for methods or constructors with ref parameters
No delegates for anonymous types (not sure if needed)
Static members are supported
Generics are supported
Nested classes are supported
Dynamic properties/fields are supported
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 1 NuGet packages that depend on ExpressionDelegates.Base:
| Package | Downloads |
|---|---|
|
ExpressionDelegates.Generation
ExpressionDelegates is a tool which generates delegates to properties, fields, methods and constructors used in linq expression trees. The purpose of this library is to compile the most common and simplest operations in expression trees during the build to avoid their slow compilation at runtime or invoсation overhead after interpretation. If your project doesn't have linq expressions to generate delegates from and you just want to use the generated delegates from other assemblies, please install `ExpressionDelegates.Base` NuGet package to avoid any code generation attempts. |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 1,076 | 11/12/2020 |