Difference between revisions of "Microgrep.cs"

From AdonaiMedrado.Pro.Br
Jump to: navigation, search
(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...)
 
(No difference)

Latest revision as of 17:34, 26 May 2009

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);
		}
	}
}