ReflectorReformatTypeName Method

Parses the specified typeName and reformats it using the specified kind, without actually resolving the type name to a Type.

Definition

Namespace: KGySoft.Reflection
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 10.5.0
C#
public static string ReformatTypeName(
	string typeName,
	TypeNameKind kind
)

Parameters

typeName  String
The type name to be parsed and reformatted.
kind  TypeNameKind
A TypeNameKind value, specifying the format of the desired result.

Return Value

String
A String, containing the reformatted name of the specified typeName.

Remarks

The typical intended usage of this method is to strip unneeded information from type names. The lower the value of the specified kind, the shorted the result will be.

This method works for any kind of type names in any format that can be produced by the Type.Name, Type.ToString, Type.FullName, Type.AssemblyQualifiedName members, and the TypeExtensions.GetName method.

  Note

As this method does not actually resolve any type, the result cannot contain more details than the originally provided name. To get an arbitrarily detailed name of a Type use the TypeExtensions.GetName method with an actual Type instead.

Exceptions

ArgumentNullExceptiontypeName is .
ArgumentExceptiontypeName cannot be parsed as a valid type name.
ArgumentOutOfRangeExceptionkind is not a defined TypeNameKind value.

See Also