Table of Contents

Struct GroupHandle

Namespace
Farkle.Grammars
Assembly
Farkle.dll

Points to a Group of a Grammar.

public readonly struct GroupHandle : IEquatable<GroupHandle>
Implements
Inherited Members

Remarks

This type is lightweight, storing just a number without a Grammar object and can be of use when parsing. To get any information about the group you have to pass it to the GetGroup(GroupHandle) method.

Properties

HasValue

Whether this GroupHandle has a valid value.

public bool HasValue { get; }

Property Value

bool
See Also

Value

Gets the group's index in the grammar.

public int Value { get; }

Property Value

int

Remarks

The first group has a value of zero.

Exceptions

InvalidOperationException

The group's HasValue property is false.

See Also

Methods

Equals(GroupHandle)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(GroupHandle other)

Parameters

other GroupHandle

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object?)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

GetHashCode()

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int

A 32-bit signed integer that is the hash code for this instance.

Operators

operator ==(GroupHandle, GroupHandle)

Checks if two GroupHandles are pointing to the same row.

public static bool operator ==(GroupHandle left, GroupHandle right)

Parameters

left GroupHandle

The first handle.

right GroupHandle

The second handle.

Returns

bool

Remarks

If left and right come from different Grammars the result is undefined.

explicit operator GroupHandle(EntityHandle)

Casts an EntityHandle to a GroupHandle.

public static explicit operator GroupHandle(EntityHandle handle)

Parameters

handle EntityHandle

The EntityHandle to cast.

Returns

GroupHandle

Exceptions

InvalidCastException

handle's IsGroup property is false.

implicit operator EntityHandle(GroupHandle)

Implicitly converts a GroupHandle to an EntityHandle.

public static implicit operator EntityHandle(GroupHandle handle)

Parameters

handle GroupHandle

The GroupHandle to convert.

Returns

EntityHandle

operator !=(GroupHandle, GroupHandle)

Checks if two GroupHandles are not pointing to the same row.

public static bool operator !=(GroupHandle left, GroupHandle right)

Parameters

left GroupHandle

The first handle.

right GroupHandle

The second handle.

Returns

bool

Remarks

If left and right come from different Grammars the result is undefined.