Method TryConstructTypeDerivedFrom
TryConstructTypeDerivedFrom<T>(out T)
Construct instance of first type derived from T.
Derived type must have an implicit, default or registered constructor.
Declaration
public static bool TryConstructTypeDerivedFrom<T>(out T value)
Parameters
| Type | Name | Description |
|---|---|---|
| T | value | New instance of derived type. |
Returns
| Type | Description |
|---|---|
| bool | true if new instance was successfully constructed, false otherwise. |
Type Parameters
| Name | Description |
|---|---|
| T | The derived type. |
TryConstructTypeDerivedFrom<T>(Func<Type, bool>, out T)
Construct instance of first type derived from T that satisfies the filtering function.
Derived type must have an implicit, default or registered constructor.
Declaration
public static bool TryConstructTypeDerivedFrom<T>(Func<Type, bool> filter, out T value)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<Type, bool> | filter | The filtering function. |
| T | value | New instance of derived type. |
Returns
| Type | Description |
|---|---|
| bool | true if new instance was successfully constructed, false otherwise. |
Type Parameters
| Name | Description |
|---|---|
| T | The derived type. |
TryConstructTypeDerivedFrom<T>(Func<T, bool>, out T)
Construct instance of first type derived from T that satisfies the condition function.
Derived type must have an implicit, default or registered constructor.
Declaration
public static bool TryConstructTypeDerivedFrom<T>(Func<T, bool> condition, out T value)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<T, bool> | condition | The condition function. |
| T | value | New instance of derived type. |
Returns
| Type | Description |
|---|---|
| bool | true if new instance was successfully constructed, false otherwise. |
Type Parameters
| Name | Description |
|---|---|
| T | The derived type. |
TryConstructTypeDerivedFrom<T>(Func<Type, bool>, Func<T, bool>, out T)
Construct instance of first type derived from T that satisfies both the filtering and condition functions.
Derived type must have an implicit, default or registered constructor.
Declaration
public static bool TryConstructTypeDerivedFrom<T>(Func<Type, bool> filter, Func<T, bool> condition, out T value)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<Type, bool> | filter | The filtering function. |
| Func<T, bool> | condition | The condition function. |
| T | value | New instance of derived type. |
Returns
| Type | Description |
|---|---|
| bool | true if new instance was successfully constructed, false otherwise. |
Type Parameters
| Name | Description |
|---|---|
| T | The derived type. |