Class ReflectionUtilities
Contains various utilities for use with .NET's reflection.
Inheritance
Namespace: DisCatSharp.Common.Utilities
Assembly: DisCatSharp.Common.dll
Syntax
public static class ReflectionUtilities
Methods
| Improve this Doc View SourceCreateEmpty(Type)
Creates an empty, uninitialized instance of specified type.
This method will not call the constructor for the specified type. As such, the object might not be properly initialized.
Declaration
public static object CreateEmpty(this Type t)
Parameters
Type | Name | Description |
---|---|---|
System.Type | t | Type of the object to instantiate. |
Returns
Type | Description |
---|---|
System.Object | Empty, uninitialized object of specified type. |
Remarks
This method is intended for reflection use only.
CreateEmpty<T>()
Creates an empty, uninitialized instance of type T
.
This method will not call the constructor for type T
. As such, the object might not be properly initialized.
Declaration
public static T CreateEmpty<T>()
Returns
Type | Description |
---|---|
T | Empty, uninitialized object of specified type. |
Type Parameters
Name | Description |
---|---|
T | Type of the object to instantiate. |
Remarks
This method is intended for reflection use only.
ToDictionary<T>(T)
Converts a given object into a dictionary of property name to property value mappings.
Declaration
public static IReadOnlyDictionary<string, object> ToDictionary<T>(this T obj)
Parameters
Type | Name | Description |
---|---|---|
T | obj | Object to convert. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IReadOnlyDictionary<System.String, System.Object> | Converted dictionary. |
Type Parameters
Name | Description |
---|---|
T | Type of object to convert. |