Class DiscriminatedUnion<TA, TB>
A data type that can store one of two possible strongly typed options.
Inheritance
System.Object
DiscriminatedUnion<TA, TB>
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: NModbus.Utility
Assembly: NModbus.dll
Syntax
public class DiscriminatedUnion<TA, TB>
Type Parameters
Name | Description |
---|---|
TA | The type of option A. |
TB | The type of option B. |
Properties
| Improve this Doc View SourceA
Gets the value of option A.
Declaration
public TA A { get; }
Property Value
Type | Description |
---|---|
TA |
B
Gets the value of option B.
Declaration
public TB B { get; }
Property Value
Type | Description |
---|---|
TB |
Option
Gets the discriminated value option set for this instance.
Declaration
public DiscriminatedUnionOption Option { get; }
Property Value
Type | Description |
---|---|
DiscriminatedUnionOption |
Methods
| Improve this Doc View SourceCreateA(TA)
Factory method for creating DiscriminatedUnion with option A set.
Declaration
public static DiscriminatedUnion<TA, TB> CreateA(TA a)
Parameters
Type | Name | Description |
---|---|---|
TA | a |
Returns
Type | Description |
---|---|
DiscriminatedUnion<TA, TB> |
CreateB(TB)
Factory method for creating DiscriminatedUnion with option B set.
Declaration
public static DiscriminatedUnion<TA, TB> CreateB(TB b)
Parameters
Type | Name | Description |
---|---|---|
TB | b |
Returns
Type | Description |
---|---|
DiscriminatedUnion<TA, TB> |
ToString()
Returns a System.String that represents the current System.Object.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | A System.String that represents the current System.Object. |
Overrides
System.Object.ToString()