This code retrieves a list of drives, stores it into an array of strings, and then loops through it to display the drives.
1. // Store the list of drives into an array of string
2. string[] DriveList = Environment.GetLogicalDrives();
3. // Loop through the array
4. for (int i = 0; i < DriveList.Length; i++)
5. {
6. // Show each drive
7. MessageBox.Show(DriveList[i]);
8. }