ObjectFactoryRegistry Class
Namespace: Stride.Core.ReflectionAssembly: Stride.Core.dll
A registry of IObjectFactory used to instantiate instances of types used at design-time.
public static class ObjectFactoryRegistry
| Name | Description | |
|---|---|---|
| Methods | ||
| CanCreateInstance(Type) | Returns true if the object of the specific type can be created. |
|
| GetFactory(Type) | Gets the factory corresponding to the given object type, if available. |
|
| NewInstance(Type) | Creates a default instance for an object type. |
|
| NewInstance<T>() | Creates a default instance for an object type. |
|
Methods
CanCreateInstance(Type)
Returns true if the object of the specific type can be created.
public static bool CanCreateInstance(Type objectType)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Type | objectType | Type of the object. |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if it can be created, false otherwise. |
GetFactory(Type)
Gets the factory corresponding to the given object type, if available.
public static IObjectFactory GetFactory(Type objectType)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Type | objectType | The object type for which to retrieve the factory. |
Returns
| Type | Description |
|---|---|
| IObjectFactory | The factory corresponding to the given object type if available, |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | objectType |
NewInstance(Type)
Creates a default instance for an object type.
public static object NewInstance(Type objectType)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Type | objectType | Type of the object. |
Returns
| Type | Description |
|---|---|
| System.Object | A new default instance of an object. |
NewInstance<T>()
Creates a default instance for an object type.
public static T NewInstance<T>()
Returns
| Type | Description |
|---|---|
| T | A new instance of T |
Type Parameters
| Name | Description |
|---|---|
| T | Type of the object to create |