Table of Contents

TypeNameOptions Class

Definition

Namespace
Cuemon.Reflection
Assemblies
Cuemon.Core.dll
Source
src/Cuemon.Core/Reflection/TypeNameOptions.cs
public sealed class TypeNameOptions : FormattingOptions, IValidatableParameterObject, IParameterObject
Inheritance
object
TypeNameOptions
Implements
Inherited Members

Examples

The following example demonstrates how to use TypeNameOptions to control the friendly name output of a Type.

using System;
using Cuemon;
using Cuemon.Reflection;

namespace Examples;

public class TypeNameFormattingExample
{
    public void Demonstrate()
    {
        // Direct instantiation of TypeNameOptions
        var options = new TypeNameOptions
        {
            FullName = true,
            ExcludeGenericArguments = false
        };

        Type type = typeof(Console);

        string friendlyName = Decorator.Enclose(type).ToFriendlyName(o =>
        {
            o.FullName = true;
            o.ExcludeGenericArguments = false;
        });
        // friendlyName == "System.Console"

        friendlyName = Decorator.Enclose(type).ToFriendlyName(o =>
        {
            o.FullName = false;
        });
        // friendlyName == "Console"

}
}

Constructors

Name Description
TypeNameOptions()

Initializes a new instance of the TypeNameOptions class.

Properties

Name Description
ExcludeGenericArguments

Gets or sets a value indicating whether to exclude generic arguments from a Type.

FriendlyNameStringConverter

Gets or sets the function delegate that convert a Type object into a human-readable string.

FullName

Gets or sets a value indicating whether to use the fully qualified name of a Type.

Methods

Name Description
ValidateOptions()

Determines whether the public read-write properties of this instance are in a valid state.