Class ExtendedTypeInfo
Provides extended information about a type.
This class is mainly used to define sets of types within the Definition class and it is not meant for other than querying the BasicTypesInfo dictionary.
Inherited Members
Namespace: Swan.Reflection
Syntax
public class ExtendedTypeInfo
Constructors
ExtendedTypeInfo(Type)
Initializes a new instance of the ExtendedTypeInfo class.
Declaration
public ExtendedTypeInfo(Type t)
Parameters
Type | Name | Description |
---|---|---|
Type | t | The t. |
Properties
CanParseNatively
Gets a value indicating whether the type contains a suitable TryParse method.
Declaration
public bool CanParseNatively { get; }
Property Value
Type | Description |
---|---|
Boolean |
|
IsNullableValueType
Gets a value indicating whether the type is a nullable value type.
Declaration
public bool IsNullableValueType { get; }
Property Value
Type | Description |
---|---|
Boolean |
|
IsNumeric
Gets a value indicating whether the type or underlying type is numeric.
Declaration
public bool IsNumeric { get; }
Property Value
Type | Description |
---|---|
Boolean |
|
IsValueType
Gets a value indicating whether the type is value type. Nullable value types have this property set to False.
Declaration
public bool IsValueType { get; }
Property Value
Type | Description |
---|---|
Boolean |
ToStringMethodInfo
Gets the ToString method info It will prefer the overload containing the IFormatProvider argument.
Declaration
public MethodInfo ToStringMethodInfo { get; }
Property Value
Type | Description |
---|---|
MethodInfo | To string method information. |
TryParseMethodInfo
Gets the try parse method information. If the type does not contain a suitable TryParse static method, it will return null.
Declaration
public MethodInfo TryParseMethodInfo { get; }
Property Value
Type | Description |
---|---|
MethodInfo | The try parse method information. |
Type
Gets the type this extended info class provides for.
Declaration
public Type Type { get; }
Property Value
Type | Description |
---|---|
Type | The type. |
UnderlyingType
When dealing with nullable value types, this property will return the underlying value type of the nullable, Otherwise it will return the same type as the Type property.
Declaration
public Type UnderlyingType { get; }
Property Value
Type | Description |
---|---|
Type | The type of the underlying. |
Methods
ToStringInvariant(Object)
Converts this instance to its string representation, trying to use the CultureInfo.InvariantCulture IFormat provider if the overload is available.
Declaration
public string ToStringInvariant(object instance)
Parameters
Type | Name | Description |
---|---|---|
Object | instance | The instance. |
Returns
Type | Description |
---|---|
String | A String that represents the current object. |
TryParse(String, out Object)
Tries to parse the string into an object of the type this instance represents. Returns false when no suitable TryParse methods exists for the type or when parsing fails for any reason. When possible, this method uses CultureInfo.InvariantCulture and NumberStyles.Any.
Declaration
public bool TryParse(string s, out object result)
Parameters
Type | Name | Description |
---|---|---|
String | s | The s. |
Object | result | The result. |
Returns
Type | Description |
---|---|
Boolean |
|