# EitherOr<Ta, Tb> struct

Namespace: [Grasshopper2.Collections](https://developer.rhino3d.com/api/gh2/namespace/grasshopper2.collections.md) · Assembly: [Grasshopper2](https://developer.rhino3d.com/api/gh2/assembly/grasshopper2.md)

```cs
public readonly struct EitherOr<Ta, Tb>
```

A pair of values, only one of which is usually set.

**Type parameters:**

- `Ta`
- `Tb`

## Constructors

- [EitherOr<Ta, Tb>](https://developer.rhino3d.com/api/gh2/type/grasshopper2.collections.eitheror-2/ctor.md): (3 overloads) Create an instance containing both an A and a B value.

## Properties

- [A](https://developer.rhino3d.com/api/gh2/type/grasshopper2.collections.eitheror-2/a.md): The Ta value, or default(Ta) if unset.
- [B](https://developer.rhino3d.com/api/gh2/type/grasshopper2.collections.eitheror-2/b.md): The Tb value, or default(Tb) if unset.
- [HasA](https://developer.rhino3d.com/api/gh2/type/grasshopper2.collections.eitheror-2/hasa.md): Gets whether the [EitherOr<Ta, Tb>.A](https://developer.rhino3d.com/api/gh2/type/grasshopper2.collections.eitheror-2/a.md) value has been set. Note that [EitherOr<Ta, Tb>.A](https://developer.rhino3d.com/api/gh2/type/grasshopper2.collections.eitheror-2/a.md) may still be null or default.
- [HasAny](https://developer.rhino3d.com/api/gh2/type/grasshopper2.collections.eitheror-2/hasany.md): Gets whether either A, or B or both have been set.
- [HasB](https://developer.rhino3d.com/api/gh2/type/grasshopper2.collections.eitheror-2/hasb.md): Gets whether the [EitherOr<Ta, Tb>.B](https://developer.rhino3d.com/api/gh2/type/grasshopper2.collections.eitheror-2/b.md) value has been set. Note that [EitherOr<Ta, Tb>.B](https://developer.rhino3d.com/api/gh2/type/grasshopper2.collections.eitheror-2/b.md) may still be null or default.
- [HasNeither](https://developer.rhino3d.com/api/gh2/type/grasshopper2.collections.eitheror-2/hasneither.md): Gets whether neither A nor B have been set.

## Methods

- [AddA](https://developer.rhino3d.com/api/gh2/type/grasshopper2.collections.eitheror-2/adda.md): Add or overwrite the A value, do not modify the B value.
- [AddB](https://developer.rhino3d.com/api/gh2/type/grasshopper2.collections.eitheror-2/addb.md): Add or overwrite the B value, do not modify the A value.
- [Equals](https://developer.rhino3d.com/api/gh2/type/grasshopper2.collections.eitheror-2/equals.md)
- [GetHashCode](https://developer.rhino3d.com/api/gh2/type/grasshopper2.collections.eitheror-2/gethashcode.md)
- [WithA](https://developer.rhino3d.com/api/gh2/type/grasshopper2.collections.eitheror-2/witha.md): Overwrite the A value, clear the B value.
- [WithB](https://developer.rhino3d.com/api/gh2/type/grasshopper2.collections.eitheror-2/withb.md): Overwrite the A value, clear the B value.

## Operators

- [operator ==](https://developer.rhino3d.com/api/gh2/type/grasshopper2.collections.eitheror-2/op-equality.md): (static)
- [operator !=](https://developer.rhino3d.com/api/gh2/type/grasshopper2.collections.eitheror-2/op-inequality.md): (static)
