Microgrep.cs

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