Show / Hide Table of Contents

Struct Children<T>

An enumerable type representing the children of a node of type T.

Implements
System.Collections.Generic.IEnumerable<T>
IEnumerable
Inherited Members
System.ValueType.Equals(System.Object)
System.ValueType.GetHashCode()
System.ValueType.ToString()
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: Sawmill
Assembly: Sawmill.dll
Syntax
public struct Children<T> : IEnumerable<T>, IEnumerable
Type Parameters
Name Description
T

The type of the rewritable object.

Remarks

Why not just use System.Collections.Generic.IEnumerable<T>? Children<T> is a value type, whereas System.Collections.Generic.IEnumerable<T> is a reference type. In cases where a node has a small, fixed number of children (fewer than three), it's much more efficient to pass those children around on the stack, rather than storing an enumerable on the heap which will quickly become garbage.

Properties

| Improve this Doc View Source

First

Gets the first element, if NumberOfChildren is One or Two.

Declaration
public T First { get; }
Property Value
Type Description
T

The first element, if NumberOfChildren is One or Two.

Exceptions
Type Condition
InvalidOperationException

Thrown when NumberOfChildren is not One or Two

| Improve this Doc View Source

Many

Gets an enumerable containing the elements, if NumberOfChildren is Many.

Declaration
public ImmutableList<T> Many { get; }
Property Value
Type Description
System.Collections.Immutable.ImmutableList<T>

An enumerable containing the elements, if if NumberOfChildren is Many.

Exceptions
Type Condition
InvalidOperationException

Thrown when NumberOfChildren is not Many

| Improve this Doc View Source

NumberOfChildren

The number of children the instance contains.

Declaration
public NumberOfChildren NumberOfChildren { get; }
Property Value
Type Description
NumberOfChildren

The number of children the instance contains.

| Improve this Doc View Source

Second

Gets the second element, if NumberOfChildren is Two.

Declaration
public T Second { get; }
Property Value
Type Description
T

The second element, if NumberOfChildren is Two.

Exceptions
Type Condition
InvalidOperationException

Thrown when NumberOfChildren is not Two

Methods

| Improve this Doc View Source

GetEnumerator()

Returns an implementation of System.Collections.Generic.IEnumerator<T> which yields the elements of the current instance.

Declaration
public Children<T>.Enumerator GetEnumerator()
Returns
Type Description
Children.Enumerator<>

An implementation of System.Collections.Generic.IEnumerator<T> which yields the elements of the current instance.

| Improve this Doc View Source

Select<U>(Func<T, U>)

Returns a new Children<T> containing the result of applying a transformation function to the elements of the current instance.

Declaration
public Children<U> Select<U>(Func<T, U> func)
Parameters
Type Name Description
System.Func<T, U> func

A transformation function to apply to the elements of the current instance

Returns
Type Description
Children<U>

A new Children<T> containing the result of applying a transformation function to the elements of the current instance.

Type Parameters
Name Description
U

Explicit Interface Implementations

| Improve this Doc View Source

IEnumerable<T>.GetEnumerator()

Declaration
IEnumerator<T> IEnumerable<T>.GetEnumerator()
Returns
Type Description
System.Collections.Generic.IEnumerator<T>
| Improve this Doc View Source

IEnumerable.GetEnumerator()

Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type Description
IEnumerator

Implements

System.Collections.Generic.IEnumerable<T>
System.Collections.IEnumerable
  • Improve this Doc
  • View Source
Back to top Copyright © 2015-2017 Microsoft
Generated by DocFX