Table of Contents

Struct LongSet

Namespace
ICSharpCode.Decompiler.Util
Assembly
ICSharpCode.Decompiler.dll

An immutable set of longs, that is implemented as a list of intervals.

public struct LongSet : IEquatable<LongSet>
Implements
Inherited Members

Constructors

LongSet(LongInterval)

Create a new LongSet that contains the values from the interval.

public LongSet(LongInterval interval)

Parameters

interval LongInterval

LongSet(IEnumerable<LongInterval>)

Creates a new LongSet the contains the values from the specified intervals.

public LongSet(IEnumerable<LongInterval> intervals)

Parameters

intervals IEnumerable<LongInterval>

LongSet(long)

Create a new LongSet that contains a single value.

public LongSet(long value)

Parameters

value long

Fields

Empty

The empty LongSet.

public static readonly LongSet Empty

Field Value

LongSet

Intervals

The intervals in this set of longs.

public readonly ImmutableArray<LongInterval> Intervals

Field Value

ImmutableArray<LongInterval>

Remarks

Invariant: the intervals in this array are non-empty, non-overlapping, non-touching, and sorted.

This invariant ensures every LongSet is always in a normalized representation.

Universe

The LongSet that contains all possible long values.

public static readonly LongSet Universe

Field Value

LongSet

Properties

IsEmpty

public bool IsEmpty { get; }

Property Value

bool

Values

public IEnumerable<long> Values { get; }

Property Value

IEnumerable<long>

Methods

AddOffset(long)

Creates a new LongSet where val is added to each element of this LongSet.

public LongSet AddOffset(long val)

Parameters

val long

Returns

LongSet

Contains(long)

public bool Contains(long val)

Parameters

val long

Returns

bool

Count()

Gets the number of values in this LongSet. Note: for LongSet.Universe, the number of values does not fit into ulong. Instead, this property returns the off-by-one value ulong.MaxValue to avoid overflow.

public ulong Count()

Returns

ulong

Equals(LongSet)

[Obsolete("Explicitly call SetEquals() instead.")]
public bool Equals(LongSet other)

Parameters

other LongSet

Returns

bool

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

ExceptWith(LongSet)

Creates a new set that contains all values that are in this, but not in other.

public LongSet ExceptWith(LongSet other)

Parameters

other LongSet

Returns

LongSet

GetHashCode()

public override int GetHashCode()

Returns

int

IntersectWith(LongSet)

public LongSet IntersectWith(LongSet other)

Parameters

other LongSet

Returns

LongSet

Invert()

Creates a new LongSet that contains all elements not contained in this LongSet.

public LongSet Invert()

Returns

LongSet

IsProperSubsetOf(LongSet)

public bool IsProperSubsetOf(LongSet other)

Parameters

other LongSet

Returns

bool

IsProperSupersetOf(LongSet)

public bool IsProperSupersetOf(LongSet other)

Parameters

other LongSet

Returns

bool

IsSubsetOf(LongSet)

Gets whether this set is a subset of other, or equal.

public bool IsSubsetOf(LongSet other)

Parameters

other LongSet

Returns

bool

IsSupersetOf(LongSet)

Gets whether this set is a superset of other, or equal.

public bool IsSupersetOf(LongSet other)

Parameters

other LongSet

Returns

bool

Overlaps(LongSet)

public bool Overlaps(LongSet other)

Parameters

other LongSet

Returns

bool

SetEquals(LongSet)

public bool SetEquals(LongSet other)

Parameters

other LongSet

Returns

bool

ToString()

public override string ToString()

Returns

string

UnionWith(LongSet)

public LongSet UnionWith(LongSet other)

Parameters

other LongSet

Returns

LongSet