Tuesday, November 08, 2011

Charles shares his Windows 8 stream story (or How he learned to deal without most of file stuff in System.IO...)

Petzold Book Blog - .NET Streams and Windows 8 IStreams

"I am currently engaged in writing an EPUB viewer for Windows 8. EPUB is a popular format for electronic books. The standard is maintained by the International Digital Publishing Forum (IDPF), and that's where you can find the documents that make up the EPUB specification. (I am basing my work on version 2.)


So far, so good. But the novice Windows 8 programmer's optimism might start to fade with a little glimpse into the System.IO namespace. The Windows 8 version of this namespace has been stripped of everything involving the file system. It is missing FileSystemInfo, File, FileInfo, Directory, DirectoryInfo, Path, and FileStream. The System.IO namespace still has a Stream class, but the only thing that derives from Stream is MemoryStream.


It slowly dawned on me why all the file-system stuff has been removed from the Windows 8 System.IO namespace: These classes access the file system, so it's likely that they would require more than 50 milliseconds to complete. Hence, they violate the "fast and fluid" rule. The Windows.Storage.* namespaces contain more modern classes for using the file system, and they are asynchronous when necessary.



I thought this a great write-up (funny that, given the author... lol ;) of one dev's mental move toward WinRT/Windows8. Many/most .Net dev who jumps into WinRT will likely fall into similar traps/mindset, so it's good to be forewarned

No comments: