Class TypeExpression
Represents an expression that can be resolved to a defined type.
Inherited Members
Namespace: TheXDS.MCART.Types
Assembly: MCART.dll
Syntax
public class TypeExpression
Constructors
| Edit this page View SourceTypeExpression(string)
Represents an expression that can be resolved to a defined type.
Declaration
public TypeExpression(string fullName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | fullName | Full name of the type this expression references. |
TypeExpression(Type)
Initializes a new instance of the TypeExpression, using the specified type as base.
Declaration
public TypeExpression(Type type)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | type | Type from which to generate the TypeExpression. |
Properties
| Edit this page View SourceFullName
Gets the full name of the type.
Declaration
public string FullName { get; }
Property Value
| Type | Description |
|---|---|
| string |
GenericArgs
Gets a collection through which generic type arguments can be retrieved and set when resolving a type.
Declaration
public ICollection<TypeExpression> GenericArgs { get; }
Property Value
| Type | Description |
|---|---|
| ICollection<TypeExpression> |
Name
Gets the name of the type.
Declaration
public string Name { get; }
Property Value
| Type | Description |
|---|---|
| string |
Namespace
Gets the namespace of the type.
Declaration
public string Namespace { get; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
| Edit this page View SourceResolve()
Resolves a type from this expression.
Declaration
[RequiresUnreferencedCode("The method obtains a collection of types without direct references, so it is not compatible with trimming.")]
[RequiresDynamicCode("The method dynamically creates new types, so it is not compatible with trimming.")]
public Type Resolve()
Returns
| Type | Description |
|---|---|
| Type | A resolved type from this expression. |
Exceptions
| Type | Condition |
|---|---|
| MissingTypeException | Thrown if it was not possible to resolve the type from the expression represented by this instance. |
Resolve(bool)
Resolves a type from this expression.
Declaration
[RequiresUnreferencedCode("The method obtains a collection of types without direct references, so it is not compatible with trimming.")]
[RequiresDynamicCode("The method dynamically creates new types, so it is not compatible with trimming.")]
public Type? Resolve(bool throwOnFail)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | throwOnFail | true to throw an exception if it is not possible to resolve the type expression represented by this instance, false to return null instead. |
Returns
| Type | Description |
|---|---|
| Type | A resolved type from this expression, or null
if the expression cannot be resolved if |
Exceptions
| Type | Condition |
|---|---|
| MissingTypeException | Thrown if it was not possible to resolve the type from the
expression represented by this instance if
|
Operators
| Edit this page View Sourceimplicit operator Type(TypeExpression)
Implicitly converts a TypeExpression to a Type.
Declaration
[RequiresUnreferencedCode("The method obtains a collection of types without direct references, so it is not compatible with trimming.")]
[RequiresDynamicCode("The method dynamically creates new types, so it is not compatible with trimming.")]
public static implicit operator Type(TypeExpression expression)
Parameters
| Type | Name | Description |
|---|---|---|
| TypeExpression | expression | Object to convert. |
Returns
| Type | Description |
|---|---|
| Type |