What better to do on a lazy and rainy Sunday that learning all 'bout .NET.
Honestly, I could easily think of two or three things to do, if it weren't for my leggs being all sore from the 'Dodentocht' yesterday :s
But, rest assured, the Training Kit had 2 very interesting lessons for me to conclude the 2nd chapter: Compression Streams and Isolated Storage.
They were so fun that I did covered them both at the same time.
1st of all using GZip or Deflate standards, you can quickly compress or decompress streams. Just create or open a stream, throwa GZipStream or DefalteStream around the thing and ready you are.
Nice to know is that compression streams work just like any other FileStream based class, so once you have your wrapper, just create a read and write like you are used to. Pretty cool stuff.
Not nice, but good to know is that compression streams are limited to 4 gigs of data.
Once you have understood Isolated Storage, you'll never write user- or application related data in the Program Files folder of the file system.
Properly used, Isolated Storage provides the means to preserve user- or app-related data on the file system, without having to worry about permissions.
In addition it's quite easy to use because, yes yes, the IsolatedStorageFileStream class inherits from.............FileStream class :-D
Once you have configured your Isolated Store, creating a file in Isolated Storage is noting more then creating a new instance of the IsolatedStorageFileStream class and using it like any other FileStream based class.
Just don't forget to tagg your code with the IsolatedStorageFilePermission attribute ;-)
The IsolatedStorageFile controls your Isolated Storage. You can use this to create directories and look for files/directories in you store. Much like the File class actually.
The only method the IsolatedStorageFile does not provide, is the FileExists and DirectoryExists methods.
To counter this, use the GetFileNames and GetFolderNames methods instead.
So, 2 new lessons done and the 2nd chapter is over and done with. Moving on, like with other stuff in my life ;-), to the 3rd chapter which is all 'bout Searching, Modifying and Encoding Text.
See you soooooooon ;-)
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment