Skip to content

Type Descriptions

The ClientBuilder provides powerful utilities to analyze .NET types using reflection, then describe them in a consistent, structured format. This is especially useful for multiple purposes.

At the center of this system are two key parts:

  • TypeDescription: a structured representation of any .NET type
  • IDescriptionExtractor: a reflection-based service that produces TypeDescription objects for any input type

What is TypeDescription?

TypeDescription is a metadata model that represents the structure and characteristics of a .NET Type. It acts like a schema snapshot for:

  • Classes
  • Interfaces
  • Enums
  • Collections
  • Generics
  • Complex domain models

What does it describe?

FieldDescription
NameThe short name of the type, e.g., User.
FullNameFully qualified .NET type name, e.g., MyApp.Domain.Models.User.
PropertiesAll public, non-static, non-excluded properties, as PropertyDescription.
IsClassTrue if the type is a class.
IsInterfaceTrue if the type is an interface.
IsEnumTrue if the type is an enum.
IsCollectionTrue if the type is a collection or array.
IsNullableTrue if the type is nullable.
IsGenericTypeTrue if the type is generic (e.g., List<T>).
GenericTypesThe generic type arguments.
GenericTypeDescriptionThe base generic type definition (List<>).
BaseTypeThe base type (e.g., a parent class).
IsComplexTrue if the type is complex (not primitive or enum).
HardcodedTrue if the description was overridden manually.
EnumValuesRaw key-value pairs for enum name and integer value.
EnumValueItemsEnum entries with friendly names, keys, etc.
SourceTypeThe original .NET Type instance.

What is PropertyDescription?

Each property inside a TypeDescription is described using PropertyDescription:

FieldDescription
NameThe property name, e.g., FirstName.
TypeIts TypeDescription.
ReadOnlyTrue if the property is read-only.
DefaultValueThe default value, if available.

What is IDescriptionExtractor?

IDescriptionExtractor is a reflection-based service for extracting TypeDescription metadata from runtime .NET Type definitions.

The extractor supports:

MethodPurpose
ExtractTypeDescriptionAnalyze a Type and produce its TypeDescription.
ExtractResponseDescriptionSame as above but wraps void/non-void logic.
ExtractArgumentDescriptionDescribe a method argument by name + type.
ExtractUniqueClassesFromClassesFind all unique classes (including nested ones).
ExtractInnerClassDescriptionsRecursively find inner classes for a given type.
ExtractUniqueEnumsFromClassesFind unique enums in a given type tree.

Released under the MIT License.