Struct ChoiceOption
A single option in a choice field's /Opt array (spec §12.7.3, Table 226).
An option carries an export value (the value submitted) and a display value
(the text shown to the user). When both are equal the option is a simple
text string; when they differ the /Opt entry is a two-element array
[exportValue, displayValue].
Implements
Inherited Members
Namespace: DRIT.Pdf.Forms
Assembly: DRIT.Pdf.dll
Syntax
public readonly struct ChoiceOption : IEquatable<ChoiceOption>
Constructors
ChoiceOption(string)
Creates a choice option with identical export and display values.
Declaration
public ChoiceOption(string value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | value | The text used for both export and display. |
ChoiceOption(string, string)
Creates a choice option with distinct export and display values.
Declaration
public ChoiceOption(string exportValue, string displayValue)
Parameters
| Type | Name | Description |
|---|---|---|
| string | exportValue | The value submitted when this option is selected. |
| string | displayValue | The text shown to the user. |
Properties
DisplayValue
The display value — the text shown to the user. Corresponds to the second element of a two-element /Opt array entry, or the sole string when export and display values are identical.
Declaration
public string DisplayValue { get; }
Property Value
| Type | Description |
|---|---|
| string |
ExportValue
The export value — the value submitted when this option is selected. Corresponds to the first element of a two-element /Opt array entry.
Declaration
public string ExportValue { get; }
Property Value
| Type | Description |
|---|---|
| string |
IsSimple
true when the export and display values are identical
(a simple string /Opt entry rather than a two-element array).
Declaration
public bool IsSimple { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Methods
Equals(ChoiceOption)
Indicates whether the current object is equal to another object of the same type.
Declaration
public bool Equals(ChoiceOption other)
Parameters
| Type | Name | Description |
|---|---|---|
| ChoiceOption | other | An object to compare with this object. |
Returns
| Type | Description |
|---|---|
| bool | true if the current object is equal to the |
Equals(object?)
Indicates whether this instance and a specified object are equal.
Declaration
public override bool Equals(object? obj)
Parameters
| Type | Name | Description |
|---|---|---|
| object | obj | The object to compare with the current instance. |
Returns
| Type | Description |
|---|---|
| bool | true if |
Overrides
GetHashCode()
Returns the hash code for this instance.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| int | A 32-bit signed integer that is the hash code for this instance. |
Overrides
ToString()
Returns the fully qualified type name of this instance.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string | The fully qualified type name. |
Overrides
Operators
operator ==(ChoiceOption, ChoiceOption)
Equality operator.
Declaration
public static bool operator ==(ChoiceOption a, ChoiceOption b)
Parameters
| Type | Name | Description |
|---|---|---|
| ChoiceOption | a | |
| ChoiceOption | b |
Returns
| Type | Description |
|---|---|
| bool |
implicit operator ChoiceOption(string)
Implicit conversion from a plain string to a simple option.
Declaration
public static implicit operator ChoiceOption(string value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | value |
Returns
| Type | Description |
|---|---|
| ChoiceOption |
operator !=(ChoiceOption, ChoiceOption)
Inequality operator.
Declaration
public static bool operator !=(ChoiceOption a, ChoiceOption b)
Parameters
| Type | Name | Description |
|---|---|---|
| ChoiceOption | a | |
| ChoiceOption | b |
Returns
| Type | Description |
|---|---|
| bool |