ExpressionExtensions¶
Strongly-typed property access via expression trees: resolving a PropertyInfo from a lambda and setting a property's value without reflecting by string name. (BR-061) through BR-064
Purpose¶
- Strongly-typed property access via expression trees: resolving a
PropertyInfofrom a lambda and setting a property's value without reflecting by string name. (BR-061) through BR-064
Context¶
- Namespace:
SAIF.Common.Extensions - Assembly/package:
SAIF.Framework.Common
Public members¶
| Member | Signature | Purpose |
|---|---|---|
| GetPropertyInfo |
public static PropertyInfo GetPropertyInfo<TTarget,TProperty>(this Expression<Func<TTarget,TProperty>> expression) |
Extracts the PropertyInfo referenced by a x => x.Property lambda. (BR-061, BR-062, BR-063) |
| SetPropertyValue |
public static void SetPropertyValue<TTarget,TProperty>(this TTarget target, PropertyInfo property, TProperty value) |
Sets a property on target given a resolved PropertyInfo. (BR-064) |
| SetPropertyValue |
public static void SetPropertyValue<TTarget,TProperty>(this TTarget target, Expression<Func<TTarget,TProperty>> expression, TProperty value) |
Resolves the property from a lambda expression and sets its value in one call. (BR-061, BR-062, BR-063, BR-064) |
Sources¶
Common/SAIF.Common/Extensions/ExpressionExtensions.cs