
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
GetLogicalDrives in C#
To get all the disk drives on a system, use the GetLogicalDrives() method in C# −
Environment.GetLogicalDrives()
Use it with Join method to get the comma-separated list of logical drives −
string.Join(",", Environment.GetLogicalDrives())
Example
using System; using System.IO; namespace Demo { class Program { static void Main(string[] args) { Console.WriteLine(string.Join(",", Environment.GetLogicalDrives())); } } }
Output
/,/etc/resolv.conf,/etc/hostname,/etc/hosts,/run/secrets,/home/cg/root
Advertisements