<Type Name="ObjectCoda" FullName="Cadenza.ObjectCoda">
  <TypeSignature Language="C#" Value="public static class ObjectCoda" />
  <TypeSignature Language="ILAsm" Value=".class public auto ansi abstract sealed beforefieldinit ObjectCoda extends System.Object" />
  <AssemblyInfo>
    <AssemblyName>Cadenza</AssemblyName>
    <AssemblyVersion>0.1.0.0</AssemblyVersion>
  </AssemblyInfo>
  <Base>
    <BaseTypeName>System.Object</BaseTypeName>
  </Base>
  <Interfaces />
  <Docs>
    <summary>Extension methods on <see cref="T:System.Object" />.</summary>
    <remarks>
    </remarks>
  </Docs>
  <Members>
    <Member MemberName="Just&lt;T&gt;">
      <MemberSignature Language="C#" Value="public static Cadenza.Maybe&lt;T&gt; Just&lt;T&gt; (this T self);" />
      <MemberSignature Language="ILAsm" Value=".method public static hidebysig valuetype Cadenza.Maybe`1&lt;!!T&gt; Just&lt;T&gt;(!!T self) cil managed" />
      <MemberType>Method</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>0.1.0.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>Cadenza.Maybe&lt;T&gt;</ReturnType>
      </ReturnValue>
      <TypeParameters>
        <TypeParameter Name="T" />
      </TypeParameters>
      <Parameters>
        <Parameter Name="self" Type="T" RefType="this" />
      </Parameters>
      <Docs>
        <typeparam name="T">
          The type to convert into a <see cref="T:Cadenza.Maybe{T}" />.
        </typeparam>
        <param name="self">
          A value of type <typeparamref name="T" /> to convert into a 
          <see cref="T:Cadenza.Maybe{T}" />.
        </param>
        <summary>
          Create a new <see cref="T:Cadenza.Maybe{T}" /> instance
          initialized to a specified value.  The returned value will not be 
          <see cref="F:Cadenza.Maybe{T}.Nothing" />.
        </summary>
        <returns>
          <para>
            A new <see cref="T:Cadenza.Maybe{T}" /> instance
            initialized to a specified value.
          </para>
          <para>
            The returned value will not be 
            <see cref="F:Cadenza.Maybe{T}.Nothing" />.
          </para>
        </returns>
        <remarks>
          <para>
            Use this method when you want to ensure that 
            <see cref="T:Cadenza.Maybe{T}" /> instance is created in which
            <see cref="P:Cadenza.Maybe{T}.Value" /> will not throw.
          </para>
        </remarks>
        <exception cref="T:System.ArgumentNullException">
          <typeparamref name="T" /> is a reference type and
          <paramref name="self" /> is <see langword="null" />.
        </exception>
        <altmember cref="M:Cadenza.ObjectCoda.ToMaybe``1(``0)" />
      </Docs>
    </Member>
    <Member MemberName="Match&lt;TSource,TResult&gt;">
      <MemberSignature Language="C#" Value="public static TResult Match&lt;TSource,TResult&gt; (this TSource self, Func&lt;TSource,Cadenza.Maybe&lt;TResult&gt;&gt;[] matchers);" />
      <MemberSignature Language="ILAsm" Value=".method public static hidebysig !!TResult Match&lt;TSource, TResult&gt;(!!TSource self, class System.Func`2&lt;!!TSource, valuetype Cadenza.Maybe`1&lt;!!TResult&gt;&gt;[] matchers) cil managed" />
      <MemberType>Method</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>0.1.0.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>TResult</ReturnType>
      </ReturnValue>
      <TypeParameters>
        <TypeParameter Name="TSource" />
        <TypeParameter Name="TResult" />
      </TypeParameters>
      <Parameters>
        <Parameter Name="self" Type="TSource" RefType="this" />
        <Parameter Name="matchers" Type="System.Func&lt;TSource,Cadenza.Maybe&lt;TResult&gt;&gt;[]">
          <Attributes>
            <Attribute>
              <AttributeName>System.ParamArray</AttributeName>
            </Attribute>
          </Attributes>
        </Parameter>
      </Parameters>
      <Docs>
        <typeparam name="TSource">The source type.</typeparam>
        <typeparam name="TResult">The result type.</typeparam>
        <param name="self">
          A value of type <typeparamref name="TSource" /> to convert to 
          <typeparamref name="TResult" />.
        </param>
        <param name="matchers">
          A <see cref="T:System.Func{TSource,Cadenza.Maybe{TResult}}" />
          array containing the conversion routines to try, in order, to
          convert <paramref name="self" /> into a 
          <typeparamref name="TResult" />.
        </param>
        <summary>
          Converts the <typeparamref name="TSource" /> instance 
          <paramref name="self" /> into a <typeparamref name="TResult" />.
        </summary>
        <returns>
          A value of type <typeparamref name="TResult" />, as returned by one
          of the conversion delegates in <paramref name="matchers" />.
        </returns>
        <remarks>
          <block subset="none" type="behaviors">
            <para>
              <paramref name="self" /> is converted into a 
              <typeparamref name="TResult" /> instance by trying each
              <see cref="T:System.Func{TSource,Cadenza.Maybe{TResult}}" />
              within <paramref name="matchers" />.
            </para>
            <para>
              This method returns the value of
              where <see cref="P:Cadenza.Maybe{TResult}.Value" /> 
              for the first delegate to return a
              <see cref="T:Cadenza.Maybe{TResult}" /> instance
              where <see cref="P:Cadenza.Maybe{TResult}.HasValue" />
              is <see langword="true" />.
            </para>
            <para>
              If no 
              <see cref="T:System.Func{TSource,Cadenza.Maybe{TResult}}" />
              returns a 
              <see cref="T:Cadenza.Maybe{TResult}" /> instance
              where <see cref="P:Cadenza.Maybe{TResult}.HasValue" />
              is <see langword="true" />, then an
              <see cref="T:System.InvalidOperationException" /> is thrown.
            </para>
          </block>
          <code lang="C#" src="../../Test/Cadenza/ObjectCodaTest.cs#Match">Assert.AreEqual ("foo",
	"foo".Match (
		s =&gt; Maybe.When (s.Length != 3, "bar!"),
		s =&gt; s.Just ()));
Assert.AreEqual ("bar!",
	5.Match (
		v =&gt; Maybe.When (v != 3, "bar!"),
		v =&gt; v.ToString ().Just()));
var m = new Func&lt;string, Maybe&lt;int&gt;&gt;[] {
	v =&gt; Maybe.When (v == "bar",    1),
	v =&gt; Maybe.When (v.Length == 5, 2),
	v =&gt; (-1).Just (),
};
Assert.AreEqual (1, "bar".Match (m));
Assert.AreEqual (2, "12345".Match (m));
Assert.AreEqual (-1, "*default*".Match (m));
</code>
        </remarks>
        <exception cref="T:System.ArgumentNullException">
          <paramref name="matchers" /> is <see langword="null" />.
        </exception>
        <exception cref="T:System.InvalidOperationException">
          None of the 
          <see cref="T:System.Func{TSource,Cadenza.Maybe{TResult}}" />
          delegates within <paramref name="matchers" /> returned a 
          <see cref="T:Cadenza.Maybe{TResult}" /> instance where
          <see cref="P:Cadenza.Maybe{TResult}.HasValue" /> was
          <see langword="true" />.
        </exception>
        <altmember cref="M:Cadenza.Maybe.When``1(System.Boolean,``0)" />
        <altmember cref="M:Cadenza.Maybe.When``1(System.Boolean,System.Func{``0})" />
      </Docs>
    </Member>
    <Member MemberName="ToMaybe&lt;T&gt;">
      <MemberSignature Language="C#" Value="public static Cadenza.Maybe&lt;T&gt; ToMaybe&lt;T&gt; (this T self);" />
      <MemberSignature Language="ILAsm" Value=".method public static hidebysig valuetype Cadenza.Maybe`1&lt;!!T&gt; ToMaybe&lt;T&gt;(!!T self) cil managed" />
      <MemberType>Method</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>0.1.0.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>Cadenza.Maybe&lt;T&gt;</ReturnType>
      </ReturnValue>
      <TypeParameters>
        <TypeParameter Name="T" />
      </TypeParameters>
      <Parameters>
        <Parameter Name="self" Type="T" RefType="this" />
      </Parameters>
      <Docs>
        <typeparam name="T">
          The type to convert into a <see cref="T:Cadenza.Maybe{T}" />.
        </typeparam>
        <param name="self">
          A value of type <typeparamref name="T" /> to convert into a 
          <see cref="T:Cadenza.Maybe{T}" />.
        </param>
        <summary>
          Create a new <see cref="T:Cadenza.Maybe{T}" /> instance
          initialized to a specified value.  The returned value may be 
          <see cref="F:Cadenza.Maybe{T}.Nothing" />.
        </summary>
        <returns>
          <para>
            A new <see cref="T:Cadenza.Maybe{T}" /> instance
            initialized to a specified value.
          </para>
          <block subset="none" type="note">
            The value returned may be 
            <see cref="F:Cadenza.Maybe{T}.Nothing" />.
          </block>
        </returns>
        <remarks>
          <para>
            Use this method when you want to ensure that a possibly invalid
            <see cref="T:Cadenza.Maybe{T}" /> instance is created.
            If <typeparamref name="T" /> is a reference type and 
            <paramref name="self" /> is <see langword="null" />, then
            <see cref="F:Cadenza.Maybe{T}.Nothing" /> will be returned;
            otherwise, a new <see cref="T:Cadenza.Maybe{T}" /> will be
            created containing the value <paramref name="self" />.
          </para>
        </remarks>
        <altmember cref="M:Cadenza.ObjectCoda.Just``1(``0)" />
      </Docs>
    </Member>
    <Member MemberName="TraverseBreadthFirst&lt;TSource,TResult&gt;">
      <MemberSignature Language="C#" Value="public static System.Collections.Generic.IEnumerable&lt;TResult&gt; TraverseBreadthFirst&lt;TSource,TResult&gt; (this TSource self, Func&lt;TSource,TResult&gt; valueSelector, Func&lt;TSource,System.Collections.Generic.IEnumerable&lt;TSource&gt;&gt; childrenSelector);" />
      <MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.Collections.Generic.IEnumerable`1&lt;!!TResult&gt; TraverseBreadthFirst&lt;TSource, TResult&gt;(!!TSource self, class System.Func`2&lt;!!TSource, !!TResult&gt; valueSelector, class System.Func`2&lt;!!TSource, class System.Collections.Generic.IEnumerable`1&lt;!!TSource&gt;&gt; childrenSelector) cil managed" />
      <MemberType>Method</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>0.1.0.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>System.Collections.Generic.IEnumerable&lt;TResult&gt;</ReturnType>
      </ReturnValue>
      <TypeParameters>
        <TypeParameter Name="TSource" />
        <TypeParameter Name="TResult" />
      </TypeParameters>
      <Parameters>
        <Parameter Name="self" Type="TSource" RefType="this" />
        <Parameter Name="valueSelector" Type="System.Func&lt;TSource,TResult&gt;" />
        <Parameter Name="childrenSelector" Type="System.Func&lt;TSource,System.Collections.Generic.IEnumerable&lt;TSource&gt;&gt;" />
      </Parameters>
      <Docs>
        <typeparam name="TSource">
          The type of the root node and intermediate nodes of the tree.
        </typeparam>
        <typeparam name="TResult">
          The type of the object to return.
        </typeparam>
        <param name="self">
          The root of a tree to traverse.
        </param>
        <param name="valueSelector">
          A <see cref="T:System.Func{TSource,TResult}" /> which is used to 
          convert tree nodes into <typeparamref name="TResult" /> instances.
        </param>
        <param name="childrenSelector">
          A <see cref="T:System.Func{TSource,System.Collections.Generic.IEnumerable{TSource}}" />
          which returns the child nodes of <paramref name="root" />
          and all intermediate non-leaf nodes.
        </param>
        <summary>
          Traverse a tree in a breadth-first fashion, converting each 
          encountered node.
        </summary>
        <returns>
          A <see cref="T:System.Collections.Generic.IEnumerable{TResult}" />
          containing the result of applying <paramref name="valueSelector" />
          to all nodes encountered while traversing the tree 
          <paramref name="self" /> in a breadth-first fashion.
        </returns>
        <remarks>
          <para>
            <paramref name="self" /> is the root node of a tree, wherein each 
            node is a data structure containing a value and child nodes.
            The value is retrieved via <paramref name="valueSelector" />,
            and the children are obtained via 
            <paramref name="childrenSelector" />.
          </para>
          <para>
            The tree is traversed in a breadth-first fashion, each encountered
            node is provided to <paramref name="valueSelector" />, and the
            values are returned.
          </para>
        </remarks>
        <example>
          <para>
            Given the <c>TreeNode&lt;T&gt;</c> declaration:
          </para>
          <code lang="C#" src="../../Test/Cadenza/ObjectCodaTest.cs#TreeNode_Declaration">class TreeNode&lt;T&gt;
{
	public TreeNode ()
	{
		Children = new TreeNode&lt;T&gt; [0];
	}

	public T Value;
	public IEnumerable&lt;TreeNode&lt;T&gt;&gt; Children;
}
</code>
          <para>
            <c>TraverseBreadthFirst()</c> is used as:
          </para>
          <code lang="C#" src="../../Test/Cadenza/ObjectCodaTest.cs#TraverseBreadthFirst">TreeNode&lt;int&gt; root = new TreeNode&lt;int&gt; {
	Value = 1, Children = new [] {
		new TreeNode&lt;int&gt; { Value = 2 },
		new TreeNode&lt;int&gt; {
			Value = 3, Children = new [] {
				new TreeNode&lt;int&gt; { Value = 5 },
			}
		},
		new TreeNode&lt;int&gt; { Value = 4 },
	}
};
IEnumerable&lt;int&gt; values = root
	.TraverseBreadthFirst (x =&gt; x.Value, x =&gt; x.Children);
AssertAreSame (new[]{ 1, 2, 3, 4, 5 }, values);
</code>
        </example>
        <exception cref="T:System.ArgumentNullException">
          <para>
            <paramref name="self" /> is <see langword="null" />.
          </para>
          <para>-or-</para>
          <para>
            <paramref name="childrenSelector" /> is <see langword="null" />.
          </para>
          <para>-or-</para>
          <para>
            <paramref name="valueSelector" /> is <see langword="null" />.
          </para>
        </exception>
      </Docs>
    </Member>
    <Member MemberName="TraverseBreadthFirstWithParent&lt;TSource,TResult&gt;">
      <MemberSignature Language="C#" Value="public static System.Collections.Generic.IEnumerable&lt;System.Collections.Generic.KeyValuePair&lt;TSource,TResult&gt;&gt; TraverseBreadthFirstWithParent&lt;TSource,TResult&gt; (this TSource self, Func&lt;TSource,TResult&gt; valueSelector, Func&lt;TSource,System.Collections.Generic.IEnumerable&lt;TSource&gt;&gt; childrenSelector);" />
      <MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.Collections.Generic.IEnumerable`1&lt;valuetype System.Collections.Generic.KeyValuePair`2&lt;!!TSource, !!TResult&gt;&gt; TraverseBreadthFirstWithParent&lt;TSource, TResult&gt;(!!TSource self, class System.Func`2&lt;!!TSource, !!TResult&gt; valueSelector, class System.Func`2&lt;!!TSource, class System.Collections.Generic.IEnumerable`1&lt;!!TSource&gt;&gt; childrenSelector) cil managed" />
      <MemberType>Method</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>0.1.0.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>System.Collections.Generic.IEnumerable&lt;System.Collections.Generic.KeyValuePair&lt;TSource,TResult&gt;&gt;</ReturnType>
      </ReturnValue>
      <TypeParameters>
        <TypeParameter Name="TSource" />
        <TypeParameter Name="TResult" />
      </TypeParameters>
      <Parameters>
        <Parameter Name="self" Type="TSource" RefType="this" />
        <Parameter Name="valueSelector" Type="System.Func&lt;TSource,TResult&gt;" />
        <Parameter Name="childrenSelector" Type="System.Func&lt;TSource,System.Collections.Generic.IEnumerable&lt;TSource&gt;&gt;" />
      </Parameters>
      <Docs>
        <typeparam name="TSource">
          The type of the root node and intermediate nodes of the tree.
        </typeparam>
        <typeparam name="TResult">
          The type of the object to return.
        </typeparam>
        <param name="self">
          The root of a tree to traverse.
        </param>
        <param name="valueSelector">
          A <see cref="T:System.Func{TSource,TResult}" /> which is used to 
          convert tree nodes into <typeparamref name="TResult" /> instances.
        </param>
        <param name="childrenSelector">
          A <see cref="T:System.Func{TSource,System.Collections.Generic.IEnumerable{TSource}}" />
          which returns the child nodes of <paramref name="root" />
          and all intermediate non-leaf nodes.
        </param>
        <summary>
          Traverse a tree in a breadth-first fashion, converting each 
          encountered node.
        </summary>
        <returns>
          <para>
            A <see cref="T:System.Collections.Generic.IEnumerable{System.Collections.Generic.KeyValuePair{TSource,TResult}}" />
            in which each returned
            <see cref="P:System.Collections.Generic.KeyValuePair{TSource,TResult}.Value" />
            is the result of applying <paramref name="valueSelector" /> to a
            node, and
            <see cref="P:System.Collections.Generic.KeyValuePair{TSource,TResult}.Key" />
            holds the parent of that node.  If the node has no parent (e.g. for
            <paramref name="self" />), then 
            <see cref="P:System.Collections.Generic.KeyValuePair{TSource,TResult}.Key" />
            will contain <c>default(TSource)</c>.
          </para>
          <para>
            Returned 
            <see cref="T:System.Collections.Generic.KeyValuePair{TSource,TResult}" />
            values come from traversing <paramref name="self" /> in a
            breadth-first order.
          </para>
        </returns>
        <remarks>
          <para>
            <paramref name="self" /> is the root node of a tree, wherein each 
            node is a data structure containing a value and child nodes.
            The value is retrieved via <paramref name="valueSelector" />,
            and the children are obtained via 
            <paramref name="childrenSelector" />.
          </para>
          <para>
            The tree is traversed in a breadth-first fashion, each encountered
            node is provided to <paramref name="valueSelector" />, and the
            values are returned.
          </para>
        </remarks>
        <exception cref="T:System.ArgumentNullException">
          <para>
            <paramref name="self" /> is <see langword="null" />.
          </para>
          <para>-or-</para>
          <para>
            <paramref name="childrenSelector" /> is <see langword="null" />.
          </para>
          <para>-or-</para>
          <para>
            <paramref name="valueSelector" /> is <see langword="null" />.
          </para>
        </exception>
      </Docs>
    </Member>
    <Member MemberName="TraverseDepthFirst&lt;TSource,TResult&gt;">
      <MemberSignature Language="C#" Value="public static System.Collections.Generic.IEnumerable&lt;TResult&gt; TraverseDepthFirst&lt;TSource,TResult&gt; (this TSource self, Func&lt;TSource,TResult&gt; valueSelector, Func&lt;TSource,System.Collections.Generic.IEnumerable&lt;TSource&gt;&gt; childrenSelector);" />
      <MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.Collections.Generic.IEnumerable`1&lt;!!TResult&gt; TraverseDepthFirst&lt;TSource, TResult&gt;(!!TSource self, class System.Func`2&lt;!!TSource, !!TResult&gt; valueSelector, class System.Func`2&lt;!!TSource, class System.Collections.Generic.IEnumerable`1&lt;!!TSource&gt;&gt; childrenSelector) cil managed" />
      <MemberType>Method</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>0.1.0.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>System.Collections.Generic.IEnumerable&lt;TResult&gt;</ReturnType>
      </ReturnValue>
      <TypeParameters>
        <TypeParameter Name="TSource" />
        <TypeParameter Name="TResult" />
      </TypeParameters>
      <Parameters>
        <Parameter Name="self" Type="TSource" RefType="this" />
        <Parameter Name="valueSelector" Type="System.Func&lt;TSource,TResult&gt;" />
        <Parameter Name="childrenSelector" Type="System.Func&lt;TSource,System.Collections.Generic.IEnumerable&lt;TSource&gt;&gt;" />
      </Parameters>
      <Docs>
        <typeparam name="TSource">
          The type of the root node and intermediate nodes of the tree.
        </typeparam>
        <typeparam name="TResult">
          The type of the object to return.
        </typeparam>
        <param name="self">
          The root of a tree to traverse.
        </param>
        <param name="valueSelector">
          A <see cref="T:System.Func{TSource,TResult}" /> which is used to 
          convert tree nodes into <typeparamref name="TResult" /> instances.
        </param>
        <param name="childrenSelector">
          A <see cref="T:System.Func{TSource,System.Collections.Generic.IEnumerable{TSource}}" />
          which returns the child nodes of <paramref name="root" />
          and all intermediate non-leaf nodes.
        </param>
        <summary>
          Traverse a tree in a depth-first fashion, converting each 
          encountered node.
        </summary>
        <returns>
          A <see cref="T:System.Collections.Generic.IEnumerable{TResult}" />
          containing the result of applying <paramref name="valueSelector" />
          to all nodes encountered while traversing the tree 
          <paramref name="self" /> in a depth-first fashion.
        </returns>
        <remarks>
          <para>
            <paramref name="self" /> is the root node of a tree, wherein each 
            node is a data structure containing a value and child nodes.
            The value is retrieved via <paramref name="valueSelector" />,
            and the children are obtained via 
            <paramref name="childrenSelector" />.
          </para>
          <para>
            The tree is traversed in a depth-first fashion, each encountered
            node is provided to <paramref name="valueSelector" />, and the
            values are returned.
          </para>
        </remarks>
        <example>
          <para>
            Given the <c>TreeNode&lt;T&gt;</c> declaration:
          </para>
          <code lang="C#" src="../../Test/Cadenza/ObjectCodaTest.cs#TreeNode_Declaration">class TreeNode&lt;T&gt;
{
	public TreeNode ()
	{
		Children = new TreeNode&lt;T&gt; [0];
	}

	public T Value;
	public IEnumerable&lt;TreeNode&lt;T&gt;&gt; Children;
}
</code>
          <para>
            <c>TraverseDepthFirst()</c> is used as:
          </para>
          <code lang="C#" src="../../Test/Cadenza/ObjectCodaTest.cs#TraverseDepthFirst">TreeNode&lt;int&gt; root = new TreeNode&lt;int&gt; {
	Value = 1, Children = new [] {
		new TreeNode&lt;int&gt; { Value = 2 },
		new TreeNode&lt;int&gt; {
			Value = 3, Children = new [] {
				new TreeNode&lt;int&gt; { Value = 5 },
			}
		},
		new TreeNode&lt;int&gt; { Value = 4 },
	}
};
IEnumerable&lt;int&gt; values = root
	.TraverseDepthFirst (x =&gt; x.Value, x =&gt; x.Children);
AssertAreSame (new[]{ 1, 2, 3, 5, 4 }, values);
</code>
        </example>
        <exception cref="T:System.ArgumentNullException">
          <para>
            <paramref name="self" /> is <see langword="null" />.
          </para>
          <para>-or-</para>
          <para>
            <paramref name="childrenSelector" /> is <see langword="null" />.
          </para>
          <para>-or-</para>
          <para>
            <paramref name="valueSelector" /> is <see langword="null" />.
          </para>
        </exception>
      </Docs>
    </Member>
    <Member MemberName="TraverseDepthFirstWithParent&lt;TSource,TResult&gt;">
      <MemberSignature Language="C#" Value="public static System.Collections.Generic.IEnumerable&lt;System.Collections.Generic.KeyValuePair&lt;TSource,TResult&gt;&gt; TraverseDepthFirstWithParent&lt;TSource,TResult&gt; (this TSource self, Func&lt;TSource,TResult&gt; valueSelector, Func&lt;TSource,System.Collections.Generic.IEnumerable&lt;TSource&gt;&gt; childrenSelector);" />
      <MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.Collections.Generic.IEnumerable`1&lt;valuetype System.Collections.Generic.KeyValuePair`2&lt;!!TSource, !!TResult&gt;&gt; TraverseDepthFirstWithParent&lt;TSource, TResult&gt;(!!TSource self, class System.Func`2&lt;!!TSource, !!TResult&gt; valueSelector, class System.Func`2&lt;!!TSource, class System.Collections.Generic.IEnumerable`1&lt;!!TSource&gt;&gt; childrenSelector) cil managed" />
      <MemberType>Method</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>0.1.0.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>System.Collections.Generic.IEnumerable&lt;System.Collections.Generic.KeyValuePair&lt;TSource,TResult&gt;&gt;</ReturnType>
      </ReturnValue>
      <TypeParameters>
        <TypeParameter Name="TSource" />
        <TypeParameter Name="TResult" />
      </TypeParameters>
      <Parameters>
        <Parameter Name="self" Type="TSource" RefType="this" />
        <Parameter Name="valueSelector" Type="System.Func&lt;TSource,TResult&gt;" />
        <Parameter Name="childrenSelector" Type="System.Func&lt;TSource,System.Collections.Generic.IEnumerable&lt;TSource&gt;&gt;" />
      </Parameters>
      <Docs>
        <typeparam name="TSource">
          The type of the root node and intermediate nodes of the tree.
        </typeparam>
        <typeparam name="TResult">
          The type of the object to return.
        </typeparam>
        <param name="self">
          The root of a tree to traverse.
        </param>
        <param name="valueSelector">
          A <see cref="T:System.Func{TSource,TResult}" /> which is used to 
          convert tree nodes into <typeparamref name="TResult" /> instances.
        </param>
        <param name="childrenSelector">
          A <see cref="T:System.Func{TSource,System.Collections.Generic.IEnumerable{TSource}}" />
          which returns the child nodes of <paramref name="root" />
          and all intermediate non-leaf nodes.
        </param>
        <summary>
          Traverse a tree in a depth-first fashion, converting each 
          encountered node.
        </summary>
        <returns>
          <para>
            A <see cref="T:System.Collections.Generic.IEnumerable{System.Collections.Generic.KeyValuePair{TSource,TResult}}" />
            in which each returned
            <see cref="P:System.Collections.Generic.KeyValuePair{TSource,TResult}.Value" />
            is the result of applying <paramref name="valueSelector" /> to a
            node, and
            <see cref="P:System.Collections.Generic.KeyValuePair{TSource,TResult}.Key" />
            holds the parent of that node.  If the node has no parent (e.g. for
            <paramref name="self" />), then 
            <see cref="P:System.Collections.Generic.KeyValuePair{TSource,TResult}.Key" />
            will contain <c>default(TSource)</c>.
          </para>
          <para>
            Returned 
            <see cref="T:System.Collections.Generic.KeyValuePair{TSource,TResult}" />
            values come from traversing <paramref name="self" /> in a
            breadth-first order.
          </para>
        </returns>
        <remarks>
          <para>
            <paramref name="self" /> is the root node of a tree, wherein each 
            node is a data structure containing a value and child nodes.
            The value is retrieved via <paramref name="valueSelector" />,
            and the children are obtained via 
            <paramref name="childrenSelector" />.
          </para>
          <para>
            The tree is traversed in a depth-first fashion, each encountered
            node is provided to <paramref name="valueSelector" />, and the
            values are returned.
          </para>
        </remarks>
        <exception cref="T:System.ArgumentNullException">
          <para>
            <paramref name="self" /> is <see langword="null" />.
          </para>
          <para>-or-</para>
          <para>
            <paramref name="childrenSelector" /> is <see langword="null" />.
          </para>
          <para>-or-</para>
          <para>
            <paramref name="valueSelector" /> is <see langword="null" />.
          </para>
        </exception>
      </Docs>
    </Member>
    <Member MemberName="With&lt;TSource,TResult&gt;">
      <MemberSignature Language="C#" Value="public static TResult With&lt;TSource,TResult&gt; (this TSource self, Func&lt;TSource,TResult&gt; selector);" />
      <MemberSignature Language="ILAsm" Value=".method public static hidebysig !!TResult With&lt;TSource, TResult&gt;(!!TSource self, class System.Func`2&lt;!!TSource, !!TResult&gt; selector) cil managed" />
      <MemberType>Method</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>0.1.0.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>TResult</ReturnType>
      </ReturnValue>
      <TypeParameters>
        <TypeParameter Name="TSource" />
        <TypeParameter Name="TResult" />
      </TypeParameters>
      <Parameters>
        <Parameter Name="self" Type="TSource" RefType="this" />
        <Parameter Name="selector" Type="System.Func&lt;TSource,TResult&gt;" />
      </Parameters>
      <Docs>
        <typeparam name="TSource">The type to operate on.</typeparam>
        <typeparam name="TResult">The type to return.</typeparam>
        <param name="self">
          A <typeparamref name="TSource" /> containing the value to manipulate.
          This value may be <see langword="null" /> (unlike most other
          extension methods).
        </param>
        <param name="selector">
          A <see cref="T:System.Func{TSource,TResult}" /> which will be
          invoked with <paramref name="self" /> as a parameter.
        </param>
        <summary>
          Supports chaining otherwise temporary values.
        </summary>
        <returns>
          The value of type <typeparamref name="TResult" /> returned by
          <paramref name="selector" />.
        </returns>
        <remarks>
          <para>
            <c>With</c> is useful for easily using an intermediate value within
            an expression "chain" without requiring an explicit variable
            declaration (which is useful for reducing in-scope variables, as no
            variable is explicitly declared).
          </para>
          <code lang="C#" src="../../Test/Cadenza/ObjectCodaTest.cs#With">// sorts the array, then returns the 
// element in the middle of the array.
Assert.AreEqual (3,
	new[]{5, 4, 3, 2, 1}.Sort ()
	.With (c =&gt; c.ElementAt (c.Count()/2)));
</code>
        </remarks>
        <exception cref="T:System.ArgumentNullException">
          <paramref name="selector" /> is <see langword="null" />.
        </exception>
      </Docs>
    </Member>
  </Members>
</Type>

