40 lines
2.0 KiB
Markdown
40 lines
2.0 KiB
Markdown
|
|
---
|
||
|
|
source_files:
|
||
|
|
- Common/DTS.Common.Storage/Classes/Static/CustomChannelFieldSizeAttribute.cs
|
||
|
|
generated_at: "2026-04-17T16:38:14.601225+00:00"
|
||
|
|
model: "zai-org/GLM-5-FP8"
|
||
|
|
schema_version: 1
|
||
|
|
sha256: "b80f469f3a04031c"
|
||
|
|
---
|
||
|
|
|
||
|
|
# Documentation: CustomChannelFieldSizeAttribute.cs
|
||
|
|
|
||
|
|
## 1. Purpose
|
||
|
|
|
||
|
|
This module provides a mechanism for associating size metadata with enum values, specifically for the `MMETables.MMEPossibleChannelsFields` enum. It defines a custom attribute `CustomChannelFieldSizeAttribute` to store integer size values, and supplies extension methods for retrieving both this specific attribute and generic attributes from enum values via reflection. This enables declarative configuration of field sizes directly on enum members.
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 2. Public Interface
|
||
|
|
|
||
|
|
### `CustomChannelFieldSizeAttribute` (Class)
|
||
|
|
A custom attribute that stores an integer size value.
|
||
|
|
|
||
|
|
| Member | Signature | Description |
|
||
|
|
|--------|-----------|-------------|
|
||
|
|
| Constructor | `internal CustomChannelFieldSizeAttribute(int size)` | Creates an instance with the specified size. **Note:** Constructor is internal. |
|
||
|
|
| Property | `public int Size { get; private set; }` | Read-only property returning the size value. |
|
||
|
|
|
||
|
|
### `CustomChannelFieldSizeExtensions` (Static Class)
|
||
|
|
Provides extension methods for retrieving field size from enum values.
|
||
|
|
|
||
|
|
| Method | Signature | Description |
|
||
|
|
|--------|-----------|-------------|
|
||
|
|
| `GetFieldSize` | `public static int GetFieldSize(MMETables.MMEPossibleChannelsFields field)` | Retrieves the `Size` value from the `CustomChannelFieldSizeAttribute` applied to the given enum value. |
|
||
|
|
|
||
|
|
### `EnumExtensions` (Static Class)
|
||
|
|
Provides a generic extension method for retrieving attributes from enum values.
|
||
|
|
|
||
|
|
| Method | Signature | Description |
|
||
|
|
|--------|-----------|-------------|
|
||
|
|
| `GetAttribute<TAttribute>` | `public static TAttribute GetAttribute<TAttribute>(this Enum value) where TAttribute : Attribute` | Retrieves a single attribute of type `TAttribute` from the given enum value using
|