FYI - Here is a code example that expands on an example found on the 'Shortcuts to Visual Basic Development with My' help topic found in help for Visual Studio 2005 Beta 1. To try it out create a Windows Forms application, add a Button to Form1, add the code below to the button handler.
' Code below demostrate these Visual Basic 2005 features:
' 1. The generic ReadOnlyCollection.
' 2. The My.Computer.FileSystem.GetDirectories Method.
' 3. The My.Computer.FileSystem.SpecialDirectories.MyDocuments Property.
' Get and display directoryPaths using My.Computer object.
' Declare a variable named directoryPaths of generic type ReadOnlyCollection
' of type String.
Dim directoryPaths As Generic.ReadOnlyCollection(Of String)
' Call the My.Computer.FileSystem.GetDirectories method passing it
' these parameters:
' 1. Directory Path: My.Computer.FileSystem.SpecialDirectories.MyDocument
' property returns a string containing the path to the special
' directory MyDocuments.
' 2. Recurse: True to ask GetDirectories to recurse the sub directories
' of the directory path (1) provided.
' 3. Parameter Array of File Wildcards: "*Logs*", "My Pictures" - indicate
' the GetDirectories method should look for directories whose names
' contain 'Logs' and directories named 'My Pictures'.
' Assign the ReadOnlyCollection object returned from the GetDirectories call
' to the directoryPaths variable.
directoryPaths = My.Computer.FileSystem.GetDirectories _
(My.Computer.FileSystem.SpecialDirectories.MyDocuments, True, "*Logs*", "My Pictures")
' Declare a variable of type string named directoryReport.
Dim directoryReport As String = "Directory Paths Found" & vbCrLf & vbCrLf
' Declare a varialbe of type string named directoryPath.
Dim directoryPath As String
' Use the directoryPath variable to loop through the directoryPath
' ReadOnlyCollection object.
For Each directoryPath In directoryPaths
' Append the directorPath string and a line feed to the
' directoryReport string.
directoryReport &= directoryPath & vbCrLf
Next
MsgBox(directoryReport)