Working with File System in LINQ

LINQ providing a functionality to work with the Files of the system. I am giving you some examples of the file system handling.
  • This first example shows you how to work with file system to get the Hidden Files information of the system.

        EXAMPLE CODE          

           Imports System.IO
            Module Module1
                Sub Main()
                    Dim files = From a In New DirectoryInfo("C:\").GetFiles() _
                        Where (a.Attributes And FileAttributes.Hidden) = FileAttributes.Hidden _
                        Order By a.Name
                    Console.WriteLine("Hidden Files:")
                    For Each a In files
                        Console.WriteLine(a.Name)
                    Next
                    Console.ReadLine()
                End Sub
            End
Module

Read Full Article here

Ebook Download
View all
Learn
View all