public class Example
{
public static void Main()
{
Console.Write("<< Enumerable.AsEnumerable 출력 예제 >> \n");
CodeGen<string> lstCodes =
new CodeGen<string> { "abc", "def", "ghi", "jkl", "mno", "oqr", "stu" };
IEnumerable<string> query = lstCodes.AsEnumerable().Where(code => code.Contains("o"));
foreach(var item in query)
{
Console.WriteLine($"value : {item}");
}
Console.WriteLine(System.Environment.NewLine);
Console.WriteLine("Press any key to exit");
Console.ReadKey();
}
}
class CodeGen<T> : List<T>
{
public IEnumerable<T> Where(Func<T, bool> predicate)
{
return Enumerable.Where(this, predicate);
}
}