Microgrep.cs
From AdonaiMedrado.Pro.Br
Revision as of 17:34, 26 May 2009 by Adonaimedrado (Talk | contribs) (New page: <code lang="csharp"> using System; using System.Collections.Generic; using System.Linq; namespace ExemploLinq { public class Grep { public static void Executar(string padrao) { s...)
using System; using System.Collections.Generic; using System.Linq; namespace ExemploLinq { public class Grep { public static void Executar(string padrao) { string[] linhas = Console.In.ReadToEnd().Split(new char[] {'\n'}); foreach(string s in linhas.Where(x=>x.Contains(padrao))) Console.WriteLine("> {0}",s); } } }