Skip to content

Instantly share code, notes, and snippets.

@eneas
Created December 8, 2016 19:59
Show Gist options
  • Save eneas/93826a2d9d7750a099f006b482f5e84a to your computer and use it in GitHub Desktop.
Save eneas/93826a2d9d7750a099f006b482f5e84a to your computer and use it in GitHub Desktop.
using System;
using System.Linq;
namespace ConsoleApplication
{
public class Program
{
public static void Main(string[] args)
{
var ary = new int[,]{{1,2,4,5},{3,4,7,16}, {2,4,9,1},{6,3,0,2}};
var rango = Enumerable.Range(0, 4);
var expr =
from i in rango
from j in rango
where ary[i,j]%2==0 || ary[i,j]%3==0
select new {i,j,n=ary[i,j]};
foreach (var e in expr) {
Console.WriteLine("{2} en ({0},{1})",e.i,e.j,e.n);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment