Show / Hide Table of Contents

Class ExpressionUtil

Class used to manipulate C# Expression-trees.

Inheritance
object
ExpressionUtil
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
Namespace: SuperOffice.Util
Assembly: SoCore.dll
Syntax
public static class ExpressionUtil

Methods

GetInstanceProvider<T, U>(Expression<Func<U>>)

Takes an expression of the type () => instance.Member and returns a function providing the instance only.

Declaration
public static Func<T> GetInstanceProvider<T, U>(Expression<Func<U>> expression)
Parameters
Type Name Description
Expression<Func<U>> expression
Returns
Type Description
Func<T>
Type Parameters
Name Description
T

Type of instance

U

GetMemberName<T>(Expression<Func<T>>)

Returns the name of the member which the expression is pointing at.

Declaration
public static string GetMemberName<T>(Expression<Func<T>> expression)
Parameters
Type Name Description
Expression<Func<T>> expression
Returns
Type Description
string
Type Parameters
Name Description
T

GetSetter<T, U>(Expression<Func<T, U>>)

Converts a i => i.Property accessor-expression into a (i,v) => i.Property = value setter-expression.

Declaration
public static Action<T, U> GetSetter<T, U>(Expression<Func<T, U>> expression)
Parameters
Type Name Description
Expression<Func<T, U>> expression
Returns
Type Description
Action<T, U>
Type Parameters
Name Description
T
U

GetSetter<T, U>(Expression<Func<U>>)

Converts a parameterless accessor-expression into a value-only setter-expression. Can be used for implicit self expressions like () => Property Or explicit instance expressions like () => instance.Property.

Declaration
public static Action<U> GetSetter<T, U>(Expression<Func<U>> expression)
Parameters
Type Name Description
Expression<Func<U>> expression
Returns
Type Description
Action<U>
Type Parameters
Name Description
T
U
© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top