Extension methods on Tuple types.
Namespace: Cadenza
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0
See Also: Inherited members from object.
⊟ Public Methods
⊟ Aggregate<T,TResult> Generic Method
Converts the Cadenza.Tuple<T> into a TResult.
public static TResult Aggregate<T, TResult> (this Tuple<T> self, Func<T, TResult> func)⊟ Type Parameters
- T
- The first value type.
- TResult
- The return value type.
⊟ Parameters
- self
- A Cadenza.Tuple<T> to aggregate the values of.
- func
- A Func<T, TResult> which will be invoked, providing the values Tuple`1.Item1 to func and returning the value returned by func.
⊟ Returns
The TResult returned by func.⊟ Exceptions
Type Reason ArgumentNullException self is null.
-or-
func is null.
⊟ Remarks
Operation
Passes the values Tuple`1.Item1 to func, returning the value produced by func.⊟ Requirements
Namespace: Cadenza
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0
⊟ Aggregate<T1,T2,TResult> Generic Method
Converts the Cadenza.Tuple<T1, T2> into a TResult.
public static TResult Aggregate<T1, T2, TResult> (this Tuple<T1, T2> self, Func<T1, T2, TResult> func)⊟ Type Parameters
- T1
- The first value type.
- T2
- The second value type.
- TResult
- The return value type.
⊟ Parameters
- self
- A Cadenza.Tuple<T1, T2> to aggregate the values of.
- func
- A Func<T1, T2, TResult> which will be invoked, providing the values Tuple`2.Item1, Tuple`2.Item2 to func and returning the value returned by func.
⊟ Returns
The TResult returned by func.⊟ Exceptions
Type Reason ArgumentNullException self is null.
-or-
func is null.
⊟ Remarks
Operation
Passes the values Tuple`2.Item1, Tuple`2.Item2 to func, returning the value produced by func.⊟ Requirements
Namespace: Cadenza
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0
⊟ Aggregate<T1,T2,T3,TResult> Generic Method
Converts the Cadenza.Tuple<T1, T2, T3> into a TResult.
public static TResult Aggregate<T1, T2, T3, TResult> (this Tuple<T1, T2, T3> self, Func<T1, T2, T3, TResult> func)⊟ Type Parameters
- T1
- The first value type.
- T2
- The second value type.
- T3
- The third value type.
- TResult
- The return value type.
⊟ Parameters
- self
- A Cadenza.Tuple<T1, T2, T3> to aggregate the values of.
- func
- A Func<T1, T2, T3, TResult> which will be invoked, providing the values Tuple`3.Item1, Tuple`3.Item2, Tuple`3.Item3 to func and returning the value returned by func.
⊟ Returns
The TResult returned by func.⊟ Exceptions
Type Reason ArgumentNullException self is null.
-or-
func is null.
⊟ Remarks
Operation
Passes the values Tuple`3.Item1, Tuple`3.Item2, Tuple`3.Item3 to func, returning the value produced by func.⊟ Requirements
Namespace: Cadenza
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0
⊟ Aggregate<T1,T2,T3,T4,TResult> Generic Method
Converts the Cadenza.Tuple<T1, T2, T3, T4> into a TResult.
public static TResult Aggregate<T1, T2, T3, T4, TResult> (this Tuple<T1, T2, T3, T4> self, Func<T1, T2, T3, T4, TResult> func)⊟ Type Parameters
- T1
- The first value type.
- T2
- The second value type.
- T3
- The third value type.
- T4
- The fourth value type.
- TResult
- The return value type.
⊟ Parameters
- self
- A Cadenza.Tuple<T1, T2, T3, T4> to aggregate the values of.
- func
- A Func<T1, T2, T3, T4, TResult> which will be invoked, providing the values Tuple`4.Item1, Tuple`4.Item2, Tuple`4.Item3, Tuple`4.Item4 to func and returning the value returned by func.
⊟ Returns
The TResult returned by func.⊟ Exceptions
Type Reason ArgumentNullException self is null.
-or-
func is null.
⊟ Remarks
Operation
Passes the values Tuple`4.Item1, Tuple`4.Item2, Tuple`4.Item3, Tuple`4.Item4 to func, returning the value produced by func.⊟ Requirements
Namespace: Cadenza
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0
⊟ Match<T,TResult> Generic Method
Converts the current Cadenza.Tuple<T> instance into a TResult.
public static TResult Match<T, TResult> (this Tuple<T> self, params Func<T, Maybe<TResult>>[] matchers)⊟ Type Parameters
- T
- The first value type.
- TResult
- The return value type.
⊟ Parameters
- self
- A Cadenza.Tuple<T> to match against.
- matchers
- A Func<T, Cadenza.Maybe<TResult>> array containing the conversion routines to use to convert the current Cadenza.Tuple<T> instance into a TResult value.
⊟ Returns
The TResult returned by one of the matchers.⊟ Exceptions
Type Reason ArgumentNullException self is null.
-or-
matchers is null.
InvalidOperationException None of the Func<TSource, Cadenza.Maybe<TResult>> delegates within matchers returned a Cadenza.Maybe<TResult> instance where Maybe<TResult>.HasValue was true. ⊟ Remarks
Operation
The current Cadenza.Tuple<T> instance is converted into a TResult instance by trying each Func<T, Cadenza.Maybe<TResult>> within matchers.
This method returns Maybe<TResult>.Value for the first delegate to return a Cadenza.Maybe<TResult> instance where Maybe<TResult>.HasValue is true.
If no Func<T, Cadenza.Maybe<TResult>> returns a Cadenza.Maybe<TResult> instance where Maybe<TResult>.HasValue is true, then an InvalidOperationException is thrown.
C# Example var a = Tuple.Create (1, 2); string b = a.Match ( (t, v) => Match.When ( t + v == 3, "foo!"), (t, v) => "*default*".Just ()); Console.WriteLine (b); // prints "foo!"⊟ Requirements
Namespace: Cadenza
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0
⊟ Match<T1,T2,TResult> Generic Method
Converts the current Cadenza.Tuple<T1, T2> instance into a TResult.
public static TResult Match<T1, T2, TResult> (this Tuple<T1, T2> self, params Func<T1, T2, Maybe<TResult>>[] matchers)⊟ Type Parameters
- T1
- The first value type.
- T2
- The second value type.
- TResult
- The return value type.
⊟ Parameters
- self
- A Cadenza.Tuple<T1, T2> to match against.
- matchers
- A Func<T1, T2, Cadenza.Maybe<TResult>> array containing the conversion routines to use to convert the current Cadenza.Tuple<T1, T2> instance into a TResult value.
⊟ Returns
The TResult returned by one of the matchers.⊟ Exceptions
Type Reason ArgumentNullException self is null.
-or-
matchers is null.
InvalidOperationException None of the Func<TSource, Cadenza.Maybe<TResult>> delegates within matchers returned a Cadenza.Maybe<TResult> instance where Maybe<TResult>.HasValue was true. ⊟ Remarks
Operation
The current Cadenza.Tuple<T1, T2> instance is converted into a TResult instance by trying each Func<T1, T2, Cadenza.Maybe<TResult>> within matchers.
This method returns Maybe<TResult>.Value for the first delegate to return a Cadenza.Maybe<TResult> instance where Maybe<TResult>.HasValue is true.
If no Func<T1, T2, Cadenza.Maybe<TResult>> returns a Cadenza.Maybe<TResult> instance where Maybe<TResult>.HasValue is true, then an InvalidOperationException is thrown.
C# Example var a = Tuple.Create (1, 2); string b = a.Match ( (t, v) => Match.When ( t + v == 3, "foo!"), (t, v) => "*default*".Just ()); Console.WriteLine (b); // prints "foo!"⊟ Requirements
Namespace: Cadenza
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0
⊟ Match<T1,T2,T3,TResult> Generic Method
Converts the current Cadenza.Tuple<T1, T2> instance into a TResult.
public static TResult Match<T1, T2, T3, TResult> (this Tuple<T1, T2, T3> self, params Func<T1, T2, T3, Maybe<TResult>>[] matchers)⊟ Type Parameters
- T1
- The first value type.
- T2
- The second value type.
- T3
- Documentation for this section has not yet been entered.
- TResult
- The return value type.
⊟ Parameters
- self
- A Cadenza.Tuple<T1, T2> to match against.
- matchers
- A Func<T1, T2, Cadenza.Maybe<TResult>> array containing the conversion routines to use to convert the current Cadenza.Tuple<T1, T2> instance into a TResult value.
⊟ Returns
The TResult returned by one of the matchers.⊟ Exceptions
Type Reason ArgumentNullException self is null.
-or-
matchers is null.
InvalidOperationException None of the Func<TSource, Cadenza.Maybe<TResult>> delegates within matchers returned a Cadenza.Maybe<TResult> instance where Maybe<TResult>.HasValue was true. ⊟ Remarks
Operation
The current Cadenza.Tuple<T1, T2> instance is converted into a TResult instance by trying each Func<T1, T2, Cadenza.Maybe<TResult>> within matchers.
This method returns Maybe<TResult>.Value for the first delegate to return a Cadenza.Maybe<TResult> instance where Maybe<TResult>.HasValue is true.
If no Func<T1, T2, Cadenza.Maybe<TResult>> returns a Cadenza.Maybe<TResult> instance where Maybe<TResult>.HasValue is true, then an InvalidOperationException is thrown.
C# Example var a = Tuple.Create (1, 2); string b = a.Match ( (t, v) => Match.When ( t + v == 3, "foo!"), (t, v) => "*default*".Just ()); Console.WriteLine (b); // prints "foo!"⊟ Requirements
Namespace: Cadenza
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0
⊟ Match<T1,T2,T3,T4,TResult> Generic Method
Converts the current Cadenza.Tuple<T1, T2> instance into a TResult.
public static TResult Match<T1, T2, T3, T4, TResult> (this Tuple<T1, T2, T3, T4> self, params Func<T1, T2, T3, T4, Maybe<TResult>>[] matchers)⊟ Type Parameters
- T1
- The first value type.
- T2
- The second value type.
- T3
- Documentation for this section has not yet been entered.
- T4
- Documentation for this section has not yet been entered.
- TResult
- The return value type.
⊟ Parameters
- self
- A Cadenza.Tuple<T1, T2> to match against.
- matchers
- A Func<T1, T2, Cadenza.Maybe<TResult>> array containing the conversion routines to use to convert the current Cadenza.Tuple<T1, T2> instance into a TResult value.
⊟ Returns
The TResult returned by one of the matchers.⊟ Exceptions
Type Reason ArgumentNullException self is null.
-or-
matchers is null.
InvalidOperationException None of the Func<TSource, Cadenza.Maybe<TResult>> delegates within matchers returned a Cadenza.Maybe<TResult> instance where Maybe<TResult>.HasValue was true. ⊟ Remarks
Operation
The current Cadenza.Tuple<T1, T2> instance is converted into a TResult instance by trying each Func<T1, T2, Cadenza.Maybe<TResult>> within matchers.
This method returns Maybe<TResult>.Value for the first delegate to return a Cadenza.Maybe<TResult> instance where Maybe<TResult>.HasValue is true.
If no Func<T1, T2, Cadenza.Maybe<TResult>> returns a Cadenza.Maybe<TResult> instance where Maybe<TResult>.HasValue is true, then an InvalidOperationException is thrown.
C# Example var a = Tuple.Create (1, 2); string b = a.Match ( (t, v) => Match.When ( t + v == 3, "foo!"), (t, v) => "*default*".Just ()); Console.WriteLine (b); // prints "foo!"⊟ Requirements
Namespace: Cadenza
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0
⊟ ToEnumerable<T> Generic Method
Converts the Cadenza.Tuple<T> into a IEnumerable<object>.
public static IEnumerable<object> ToEnumerable<T> (this Tuple<T> self)⊟ Type Parameters
- T
- The first value type.
⊟ Parameters
- self
- A Cadenza.Tuple<T> to convert into an IEnumerable<object>.
⊟ Returns
A IEnumerable<object>.⊟ Exceptions
Type Reason ArgumentNullException if self is null. ⊟ Remarks
Operation
Passes the values Tuple`1.Item1 to func, returning the value produced by func.⊟ Requirements
Namespace: Cadenza
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0
⊟ ToEnumerable<T1,T2> Generic Method
Converts the Cadenza.Tuple<T1, T2> into a IEnumerable<object>.
public static IEnumerable<object> ToEnumerable<T1, T2> (this Tuple<T1, T2> self)⊟ Type Parameters
- T1
- The first value type.
- T2
- The second value type.
⊟ Parameters
- self
- A Cadenza.Tuple<T1, T2> to convert into an IEnumerable<object>.
⊟ Returns
A IEnumerable<object>.⊟ Exceptions
Type Reason ArgumentNullException if self is null. ⊟ Remarks
Operation
Passes the values Tuple`2.Item1, Tuple`2.Item2 to func, returning the value produced by func.⊟ Requirements
Namespace: Cadenza
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0
⊟ ToEnumerable<T1,T2,T3> Generic Method
Converts the Cadenza.Tuple<T1, T2, T3> into a IEnumerable<object>.
public static IEnumerable<object> ToEnumerable<T1, T2, T3> (this Tuple<T1, T2, T3> self)⊟ Type Parameters
- T1
- The first value type.
- T2
- The second value type.
- T3
- The third value type.
⊟ Parameters
- self
- A Cadenza.Tuple<T1, T2, T3> to convert into an IEnumerable<object>.
⊟ Returns
A IEnumerable<object>.⊟ Exceptions
Type Reason ArgumentNullException if self is null. ⊟ Remarks
Operation
Passes the values Tuple`3.Item1, Tuple`3.Item2, Tuple`3.Item3 to func, returning the value produced by func.⊟ Requirements
Namespace: Cadenza
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0
⊟ ToEnumerable<T1,T2,T3,T4> Generic Method
Converts the Cadenza.Tuple<T1, T2, T3, T4> into a IEnumerable<object>.
public static IEnumerable<object> ToEnumerable<T1, T2, T3, T4> (this Tuple<T1, T2, T3, T4> self)⊟ Type Parameters
- T1
- The first value type.
- T2
- The second value type.
- T3
- The third value type.
- T4
- The fourth value type.
⊟ Parameters
- self
- A Cadenza.Tuple<T1, T2, T3, T4> to convert into an IEnumerable<object>.
⊟ Returns
A IEnumerable<object>.⊟ Exceptions
Type Reason ArgumentNullException if self is null. ⊟ Remarks
Operation
Passes the values Tuple`4.Item1, Tuple`4.Item2, Tuple`4.Item3, Tuple`4.Item4 to func, returning the value produced by func.⊟ Requirements
Namespace: Cadenza
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0
⊟ ToKeyValuePair<TKey,TValue> Generic Method
Converts a Cadenza.Tuple<TKey, TValue> into a KeyValuePair<TKey, TValue>.
public static KeyValuePair<TKey, TValue> ToKeyValuePair<TKey, TValue> (this Tuple<TKey, TValue> self)⊟ See Also
⊟ Type Parameters
- TKey
- The type of the key.
- TValue
- The type of the value.
⊟ Parameters
- self
- A Cadenza.Tuple<TKey, TValue> to convert into a KeyValuePair<TKey, TValue>.
⊟ Returns
A KeyValuePair<TKey, TValue> structure.⊟ Remarks
The value of the returned KeyValuePair`2.Key property is copied from Tuple`2._1 and the value of the returned KeyValuePair`2.Value is copied from Tuple`2._2.
C# Example var tuple = Tuple.Create ("s", 1); KeyValuePair<string, int> kvp = tuple.ToKeyValuePair (); // kvp.Key == "s", kvp.Value == 1⊟ Requirements
Namespace: Cadenza
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0