Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Touring Whidbey's Base Class Library Enhancements : Page 2

The core API set underpinning managed application development in .NET—the Base Class Libraries (BCL)—have received several notable additions in the Whidbey release. Find out performance-based improvements, class-oriented feature additions, and the introduction of previously missing functionality through entirely new classes.


advertisement
New Classes
Many of the new Whidbey BCL classes provide functionality directly through the .NET Framework that were previously available to developers only through COM interoperability and/or third-party APIs, or functionality that could be obtained through substantially less convenient avenues.

Obtaining Drive Information
One new BCL enhancement, the DriveInfo class which you'll find in the System.IO namespace, provides functionality similar to the FileInfo and DirectoryInfo classes already found in the System.IO namespace. DriveInfo provides methods and properties to query information about a current drive on the system or, through the shared GetDrives method, retrieves an array of DriveInfo objects representing all the logical drive names on a computer. Developers will typically use this class to determine available size, or total size, as shown in Figure 1, or to determine whether a drive is a hard disk, network share, or floppy drive. To retrieve information about the "C" drive, you could use code similar to the following:

Dim c As New DriveInfo("C") Console.WriteLine("Data for Drive C:") Console.WriteLine("Avail: {0} bytes", _ c.AvailableFreeSpace) Console.WriteLine("Total Free: {0} bytes", _ c.TotalFreeSpace) Console.WriteLine("Format: {0}", c.DriveFormat) Console.WriteLine("Type: {0}", c.DriveType) Console.WriteLine("Name: {0}", c.Name) Console.WriteLine("Size: {0}", c.TotalSize) Console.WriteLine("Label: {0}", c.VolumeLabel)



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Thanks for your registration, follow us on our social networks to keep up-to-date