System.IO.DriveInfo.GetDrives C# (CSharp) Метод

GetDrives() публичный статический Метод

public static GetDrives ( ) : System.IO.DriveInfo[]
Результат System.IO.DriveInfo[]
        public static DriveInfo[] GetDrives()
        {
            string[] drives = DriveInfoInternal.GetLogicalDrives();
            DriveInfo[] result = new DriveInfo[drives.Length];
            for (int i = 0; i < drives.Length; i++)
            {
                result[i] = new DriveInfo(drives[i]);
            }
            return result;
        }

Same methods

DriveInfo::GetDrives ( ) : System.IO.DriveInfo[]

Usage Example

Пример #1
0
 public IReadOnlyList <DriveInfo> GetMountedDrives() =>
 IoDriveInfo
 .GetDrives()
 .Select(CreateFrom)
 .WhereNotNull()
 .ToArray();