Provides a view of an arbitrary type that unifies a number of discrete concepts in the CLR. Arrays and Collection types have special support, but their APIs are unified by the TypeMetadata so that they can be treated as if they were a regular type.
More...
|
object | CreateInstance () |
| Creates a new instance of the type that this metadata points back to. More...
|
|
void | CollectionSizeHint (ref object context, int size) |
| Hint that there will be size number of elements stored in the given collection. This method is completely optional, but if the collection is an array then it will improve the performance of AppendValue. More...
|
|
void | AppendValue (ref object context, object value, int indexHint) |
| Appends a value to the end of the array or collection. If the collection is an array, then the item is added to array[indexHint]. If it is a collection, then the item is just appended to the end of the collection. More...
|
|
bool | RemoveProperty (string propertyName) |
| Attempts to remove the property with the given name. More...
|
|
|
Type | ReflectedType [get, set] |
| The type that this metadata is modeling, ie, the type that the metadata was constructed off of. More...
|
|
Type | ElementType [get] |
| Iff this metadata maps back to a Collection or an Array type, then this is the type of element stored inside the array or collection. Otherwise, this method throws an exception. More...
|
|
bool | IsCollection [get, set] |
| True if the base type is a collection. If true, accessing Properties will throw an exception. More...
|
|
IEnumerable< PropertyMetadata > | Properties [get] |
| The properties on the type. This is used when importing/exporting a type that does not have a user-defined importer/exporter. More...
|
|
Provides a view of an arbitrary type that unifies a number of discrete concepts in the CLR. Arrays and Collection types have special support, but their APIs are unified by the TypeMetadata so that they can be treated as if they were a regular type.
void Forge.Utilities.TypeMetadata.AppendValue |
( |
ref object |
context, |
|
|
object |
value, |
|
|
int |
indexHint |
|
) |
| |
Appends a value to the end of the array or collection. If the collection is an array, then the item is added to array[indexHint]. If it is a collection, then the item is just appended to the end of the collection.
void Forge.Utilities.TypeMetadata.CollectionSizeHint |
( |
ref object |
context, |
|
|
int |
size |
|
) |
| |
Hint that there will be size number of elements stored in the given collection. This method is completely optional, but if the collection is an array then it will improve the performance of AppendValue.
- Parameters
-
context | The collection type. |
size | The size hint to use for the collection |
object Forge.Utilities.TypeMetadata.CreateInstance |
( |
| ) |
|
Creates a new instance of the type that this metadata points back to.
Activator.CreateInstance cannot be used because TypeMetadata can point to an Array.
bool Forge.Utilities.TypeMetadata.RemoveProperty |
( |
string |
propertyName | ) |
|
Attempts to remove the property with the given name.
- Parameters
-
propertyName | The name of the property to remove. |
- Returns
- True if the property was removed, false if it was not found.
Type Forge.Utilities.TypeMetadata.ElementType |
|
get |
Iff this metadata maps back to a Collection or an Array type, then this is the type of element stored inside the array or collection. Otherwise, this method throws an exception.
bool Forge.Utilities.TypeMetadata.IsCollection |
|
getset |
True if the base type is a collection. If true, accessing Properties will throw an exception.
The properties on the type. This is used when importing/exporting a type that does not have a user-defined importer/exporter.
Type Forge.Utilities.TypeMetadata.ReflectedType |
|
getset |
The type that this metadata is modeling, ie, the type that the metadata was constructed off of.
The documentation for this class was generated from the following file:
- Forge.Utilities/TypeMetadata.cs