title: Are there already built in functional C#/.NET constructs like these? g(h()), or
body: <pre><code>public static Func&lt;V&gt; To&lt;T, V&gt;(this Func&lt;T&gt; g, Func&lt;T, V&gt; h)
  {
      return () =&gt; h(g());
  }
  
  public static Func&lt;T&gt; ToIdentity&lt;T&gt;(this T t)
  {
      return () =&gt; t;
  }
  </code></pre>
  
  <p>I sometimes use these and others when delaying evaluation.  Are these already in the .net library?</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>Here is an example usage:</p>
  
  <pre><code>public static string SuffixColumn(this string v, string suffix, int columns)
  {
      return
      v.ToIdentity()
          .ToScrubbedHtml()
          .ToFormat(() =&gt; "{0} " + suffix.ToLower().PadLeft(columns, ' '))
          .ToErrorText(v, suffix, columns)();
  }
  </code></pre>
  
  <p>ToErrorText checks 'v' as legitimate (non-error code, non-null, etc), if good it runs the chained in Func, if bad it produces fail-safe text result.  If v, suffix, or columns are not good then ToFormat will never be called.  (Hence the delayed/non-evaluated usage).</p>
  
  <p>ToFormat is nearly the composition of the provided Func and string.Format.  ToIdentity is used to lift v to a Func and then everything in the chain is based on some Func of T.</p>