Class EnumAttributeMappingBuilder<TEnum>
- Namespace
- Garyon.Reflection
- Assembly
- Garyon.dll
Represents a fluent builder for configuring enum attribute mappings.
public sealed class EnumAttributeMappingBuilder<TEnum> where TEnum : struct, Enum
Type Parameters
TEnumThe type of the enum whose fields to map.
- Inheritance
-
EnumAttributeMappingBuilder<TEnum>
- Inherited Members
- Extension Methods
Methods
Where(Func<TEnum, bool>)
Restricts the enum values that participate in the mapping.
public EnumAttributeMappingBuilder<TEnum> Where(Func<TEnum, bool> predicate)
Parameters
predicateFunc<TEnum, bool>The predicate that determines whether a given enum value should be included.
Returns
- EnumAttributeMappingBuilder<TEnum>
WithAttributeKey<TAttribute>(Func<TAttribute, object?>)
Configures the mapping to use a selected value from the attribute as the mapped value.
public EnumAttributeMappingBuilder<TEnum, TAttribute, object> WithAttributeKey<TAttribute>(Func<TAttribute, object?> selector) where TAttribute : Attribute
Parameters
Returns
- EnumAttributeMappingBuilder<TEnum, TAttribute, object>
Type Parameters
TAttributeThe type of the attribute to retrieve from each enum field.
WithAttributeKey<TAttribute, TMappedValue>(Func<TAttribute, TMappedValue?>)
Configures the mapping to use a selected value from the attribute as the mapped value.
public EnumAttributeMappingBuilder<TEnum, TAttribute, TMappedValue> WithAttributeKey<TAttribute, TMappedValue>(Func<TAttribute, TMappedValue?> selector) where TAttribute : Attribute
Parameters
selectorFunc<TAttribute, TMappedValue>The selector that chooses the mapped value from the attribute.
Returns
- EnumAttributeMappingBuilder<TEnum, TAttribute, TMappedValue>
Type Parameters
TAttributeThe type of the attribute to retrieve from each enum field.
TMappedValueThe type of the mapped value.
WithAttribute<TAttribute>()
Configures the mapping to use the entire attribute instance as the mapped value.
public EnumAttributeMappingBuilder<TEnum, TAttribute, TAttribute> WithAttribute<TAttribute>() where TAttribute : Attribute
Returns
- EnumAttributeMappingBuilder<TEnum, TAttribute, TAttribute>
Type Parameters
TAttributeThe type of the attribute to retrieve from each enum field.