Skip to content

Instantly share code, notes, and snippets.

@mariusGundersen
Created October 21, 2018 12:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mariusGundersen/d8400ad900e4fa3ac57d707e1df1207e to your computer and use it in GitHub Desktop.
Save mariusGundersen/d8400ad900e4fa3ac57d707e1df1207e to your computer and use it in GitHub Desktop.
Duct-typed extension methods Example 9
// Example 9: multi or single dimensional arrays?
// We define this extension method
public static void Add<T>(this List<T> list, params T[] items)
=> list.AddRange(items);
// And then we can make a flattened matrix
var matrix = new List<double>
{
{ 1, 0, 0 },
{ 0, 1, 0 },
{ 0, 0, 1 }
};
Console.WriteLine(matrix.Count);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment