LINQ
Standard Query Operators
var folders = System.IO.Directory.GetDirectories(
@"C:\").Where(d => d.Length > 5).OrderBy(d => d.Length);
foreach (string folder in folders)
{
System.Windows.Forms.MessageBox.Show(folder);
}
Query Expression Syntax
var folders =
from d in System.IO.Directory.GetDirectories(@"C:\")
where d.Length > 5
orderby d.Length
select d;
foreach (string folder in folders)
{
System.Windows.Forms.MessageBox.Show(folder);
}
© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext