Xceed .NET Libraries Documentation
GetFolders(FileSystemEvents,Object,Boolean,Object[]) Method


Xceed.FileSystem Assembly > Xceed.FileSystem Namespace > AbstractFolder Class > GetFolders Method : GetFolders(FileSystemEvents,Object,Boolean,Object[]) Method
A FileSystemEvents object that will be used to raise events. Cannot be a null reference (Nothing in Visual Basic).
Opaque data that will be passed back to the event handler when an event is raised.
true if folders contained in the subfolders should be returned; false if only folders that are immediate children of the folder should be returned.
An array of objects that can be used to filter the list of folders returned.
Returns a filtered list of folders contained in the folder, and raises events during the process.
Syntax
'Declaration
 
Public Overloads Function GetFolders( _

   ByVal events As FileSystemEvents, _

   ByVal userData As Object, _

   ByVal recursive As Boolean, _

   ByVal ParamArray filters() As Object _

) As AbstractFolder()
'Usage
 
Dim instance As AbstractFolder

Dim events As FileSystemEvents

Dim userData As Object

Dim recursive As Boolean

Dim filters() As Object

Dim value() As AbstractFolder

 

value = instance.GetFolders(events, userData, recursive, filters)
public AbstractFolder[] GetFolders( 

   FileSystemEvents events,

   object userData,

   bool recursive,

   params object[] filters

)

Parameters

events
A FileSystemEvents object that will be used to raise events. Cannot be a null reference (Nothing in Visual Basic).
userData
Opaque data that will be passed back to the event handler when an event is raised.
recursive
true if folders contained in the subfolders should be returned; false if only folders that are immediate children of the folder should be returned.
filters
An array of objects that can be used to filter the list of folders returned.

Return Value

An array of AbstractFolder objects representing the folders that match the specified filters.
Remarks

To filter a list of files or folders, you can pass a variable number of objects in the filters parameter. These objects may be of the following types:

Object type Type of filter applied
System.String The string is assumed to be a file mask, and a NameFilter object is automatically created for the passed string, with FilterScope.File as the default FilterScope.
System.IO.FileAttributes A AttributeFilter object is automatically created for the provided attributes, with FilterScope.File as the default FilterScope.
Filter The provided Filter object is used as-is.
Array of System.Object Each object in the array may be of the types described in this table, and is used accordingly.
Other If any other type is found, an exception is thrown.

Note that when passing a string, for example "folder", as the folder to retrieve in the filters parameter, a NameFilter class will be created around the string. By default, the FilterScope of the NameFilter class is FilterScope.File. This means that only files will be filter and all folders will be returned.

In order to filter folders, a NameFilter class needs to be constructed around the string and the FilterScope must be set to FilterScope.Folder. For example:



GetFolders( true, new NameFilter( "folder", FilterScope.Folder ) );

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

AbstractFolder Class
AbstractFolder Members
Overload List