Table of Contents

Class OverrideTypeReaderAttribute

Namespace
Fluxer.Net.Commands
Assembly
Fluxer.Net.dll

Marks the Type to be read by the specified TypeReader.

[AttributeUsage(AttributeTargets.Property|AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)]
public sealed class OverrideTypeReaderAttribute : Attribute
Inheritance
object
Attribute
OverrideTypeReaderAttribute

Examples

In this example, the TimeSpan will be read by a custom TypeReader, FriendlyTimeSpanTypeReader, instead of the Fluxer.Net.Commands.TimeSpanTypeReader

[Command("time")]
public Task GetTimeAsync([OverrideTypeReader(typeof(FriendlyTimeSpanTypeReader))]TimeSpan time)
    => ReplyAsync(time);

Remarks

This attribute will override the TypeReader to be used when parsing for the desired type in the command. This is useful when one wishes to use a particular TypeReader without affecting other commands that are using the same target type.

warning

If the given type reader does not inherit from TypeReader, an ArgumentException will be thrown.

Constructors

OverrideTypeReaderAttribute(Type)

public OverrideTypeReaderAttribute(Type overridenTypeReader)

Parameters

overridenTypeReader Type

The TypeReader to be used with the parameter.

Exceptions

ArgumentException

The given overridenTypeReader does not inherit from TypeReader.

Properties

TypeReader

Gets the specified TypeReader of the parameter.

public Type TypeReader { get; }

Property Value

Type