FileSystemItem.IsDirectory Property

Specifies whether a file system item is a directory.

Namespace: DevExtreme.AspNet.Mvc.FileManagement

Assembly: DevExtreme.AspNet.Core.dll

Declaration

public bool IsDirectory { get; set; }

Property Value

Type Description
Boolean

true, if a file system item is a directory; otherwise, false.

Remarks

The following example illustrates how to use the IsDirectory and HasSubDirectories properties inside the GetItems(FileSystemLoadItemOptions) method. Refer to the FileManager - Binding to Entity Framework ORM online demo to see the whole code.

File system provider:

public IEnumerable<FileSystemItem> GetItems(FileSystemLoadItemOptions options) {
    int parentId = ParseKey(options.Directory.Key);
    var fileItems = GetDirectoryContents(parentId);
    var hasSubDirectoriesInfo = GetHasSubDirectoriesInfo(fileItems);

    var clientItemList = new List<FileSystemItem>();
    foreach(var item in fileItems) {
        var clientItem = new FileSystemItem {
            IsDirectory = item.IsDirectory,
            ...
        };
        if(item.IsDirectory) {
            clientItem.HasSubDirectories = hasSubDirectoriesInfo.ContainsKey(item.Id) && hasSubDirectoriesInfo[item.Id];
        }
        clientItemList.Add(clientItem);
    }
    return clientItemList;
}

Concepts

Online Demos

See Also