Click or drag to resize

ValueExpressionParserTCreateInstance(IEnumerablePropertyInfo, TypeRegistry) Method

Generates a delegate that will create new instance of type T applying any specified DefaultValueAttribute or DefaultValueExpressionAttribute instances that are declared on the type T properties.

Namespace: GSF.ComponentModel
Assembly: GSF.Core (in GSF.Core.dll) Version: 2.4.207-beta+1781b796b2aa7a54013a031eb432fe4ccee31867
Syntax
public static Func<T> CreateInstance(
	IEnumerable<PropertyInfo> properties = null,
	TypeRegistry typeRegistry = null
)
View Source

Parameters

properties  IEnumerablePropertyInfo  (Optional)
Specific properties to target, or null to target all properties.
typeRegistry  TypeRegistry  (Optional)
Type registry to use when parsing DefaultValueExpressionAttribute instances, or null to use DefaultTypeRegistry.

Return Value

FuncT
Generated delegate that will create new T instances with default values applied.
Remarks
This function is useful for generating a delegate to a compiled function that will create new objects of type T where properties of the type of have been decorated with DefaultValueAttribute or DefaultValueExpressionAttribute attributes. The newly created object will automatically have applied any defined default values as specified by the encountered attributes.
Note  Note
This function will assign evaluated expression values to properties in a newly created model.
See Also