With LINQ Functionality Get The File With Particular Extension
using System;
using System.Linq;
class CheckExtensionWithLINQ
{
static void Main()
{
string[] sarr = {"a.txt", "b.txt","c.doc", "d.doc",
"e.ppt","f.ppt","g.xls","h.xls","i.txt"};
var result = from a in sarr
where a.EndsWith("txt")
select a;
foreach(var r in result)
{
Console.WriteLine("File name is " + r);
}
}
}
OUTPUT
With LINQ Functionality Get The File With Particular Extension
Reviewed by Baljeet Singh
on
12:28
Rating:
No comments: