Avatar of Arnold Layne
Arnold LayneFlag for United States of America

asked on 

DriveInfo and DriveType question

DriveInfo info = new DriveInfo(drive);
        switch (info.DriveType)
        {
          case DriveType.CDRom:
            Console.WriteLine("CDROM drive");
            break;

Why does this code from a tutorial have "case DriveType.CdRom" instead of just "case CDRom"?

I thought that if info.DriveType is a property that returns a string, than it would return "CDRom". So why the leading DriveType in DriveType.CDRom?
C#

Avatar of undefined
Last Comment
Korbus
SOLUTION
Avatar of AndyAinscow
AndyAinscow
Flag of Switzerland image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
ASKER CERTIFIED SOLUTION
Avatar of Korbus
Korbus

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
C#
C#

C# is an object-oriented programming language created in conjunction with Microsoft’s .NET framework. Compilation is usually done into the Microsoft Intermediate Language (MSIL), which is then JIT-compiled to native code (and cached) during execution in the Common Language Runtime (CLR).

98K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo