Class DeviceFieldAttribute

Namespace
ProtoTest.Devices
Assembly
ProtoTest.Devices.dll

How one field is written and read. On a positional record the field order is the parameter order; on a class with settable properties, Order sets it.

[AttributeUsage(AttributeTargets.Property|AttributeTargets.Parameter, Inherited = false)]
public sealed class DeviceFieldAttribute : Attribute
Inheritance
DeviceFieldAttribute
Inherited Members
Extension Methods

Constructors

DeviceFieldAttribute(int)

Creates the attribute; pass an order for a class, leave it out on a positional record.

public DeviceFieldAttribute(int order = -1)

Parameters

order int

Properties

Bytes

Gets or sets a binary string's or byte array's fixed size in bytes.

public int Bytes { get; set; }

Property Value

int

Format

Gets or sets a text field's format: a .NET format string for numbers, dates and times (0.00, yyyyMMddHHmmss), D for an enum's number, or true|false words for a boolean. A conversion a format string cannot express belongs in a DeviceFormatAttribute<TFormatter>.

public string? Format { get; set; }

Property Value

string

Order

Gets the field's position, counted from zero after the prefix.

public int Order { get; }

Property Value

int

Pad

Gets or sets the padding character: for Width in text, for Bytes in a binary string. Defaults to a space in text and a zero byte in binary.

public char Pad { get; set; }

Property Value

char

PadLeft

Gets or sets whether text padding goes on the left, as for zero-padded numbers. Defaults to the right.

public bool PadLeft { get; set; }

Property Value

bool

Width

Gets or sets a text field's fixed width; the value is padded to it when written and trimmed when read.

public int Width { get; set; }

Property Value

int