Interface IPrimitiveFactory
This interface provides methods for creating instances of Primitively types.
Namespace: Primitively
Assembly: Primitively.Abstractions.dll
Syntax
public interface IPrimitiveFactory
Methods
Create(Type, string?)
Creates an instance of a specific Primitively type.
Declaration
IPrimitive? Create(Type type, string? value)
Parameters
Type | Name | Description |
---|---|---|
Type | type | The .NET type of the Primitively type. |
string | value | The string representation of the value to encapsulate in the Primitively type. |
Returns
Type | Description |
---|---|
IPrimitive | An instance of the Primitively type, or null if the value is not valid for the type. |
TryCreate(Type, string?, out IPrimitive?)
Attempts to create an instance of a specific Primitively type.
Declaration
bool TryCreate(Type type, string? value, out IPrimitive? result)
Parameters
Type | Name | Description |
---|---|---|
Type | type | The .NET type of the Primitively type. |
string | value | The string representation of the value to encapsulate in the Primitively type. |
IPrimitive | result | When this method returns, contains the created Primitively type, if the operation succeeded, or null if it did not. |
Returns
Type | Description |
---|---|
bool |
|