Class ValueEnumerable<T>
A IValueEnumerable<T> implementation, wrapping a generic
Inherited Members
Namespace: MoreStructures.Utilities
Assembly: MoreStructures.dll
Syntax
public class ValueEnumerable<T> : IValueEnumerable<T>
Type Parameters
Name | Description |
---|---|
T | The type of objects of the wrapped enumerable. |
Remarks
Useful to preserve equality by value in records and other value structures which contain enumerable objects.
It doesn't cache nor enumerate the underlying MoreStructures.Utilities.ValueEnumerable`1.Enumerable unless GetEnumerator() or a
method requiring MoreStructures.Utilities.ValueEnumerable`1.Enumerable items is called.
Constructors
| Improve this Doc View SourceValueEnumerable(IEnumerable<T>)
Builds a ValueEnumerable<T> around the provided enumerable
.
Declaration
public ValueEnumerable(IEnumerable<T> enumerable)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.IEnumerable<T> | enumerable | The enumerable to wrap. |
Remarks
Time and Space Complexity is O(1), as this constructor doesn't enumerate enumerable
.
Methods
| Improve this Doc View SourceEquals(Object)
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
Remarks
In the specific case, equality is based on the
Therefore, Time Complexity is O(n * Te) and Space Complexity is O(Se), where n is the number of elements of
the longest MoreStructures.Utilities.ValueEnumerable`1.Enumerable and Te/Se are the time and space costs of
System.Object.Equals(System.Object) of two T
instances.
GetEnumerator()
Declaration
public IEnumerator<T> GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.IEnumerator<T> |
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 |
Overrides
Remarks
In the specific case, the hash is calculated as an aggregation of the hash codes of the items of the
wrapped MoreStructures.Utilities.ValueEnumerable`1.Enumerable object.
Therefore, Time Complexity is O(n * Te) and Space Complexity is O(Se), where n is the number of elements of
the longest MoreStructures.Utilities.ValueEnumerable`1.Enumerable and Te/Se are the time and space costs of
System.Object.GetHashCode() of a T
instance.
ToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String |
Overrides
Remarks
In the specific case, the string calculation is delegated to the wrapped
Therefore, Time and Space Complexity are the ones of the specific implementation of
System.Object.ToString() of the underlying MoreStructures.Utilities.ValueEnumerable`1.Enumerable.
Explicit Interface Implementations
| Improve this Doc View SourceIEnumerable.GetEnumerator()
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.IEnumerator |