DotNetBlog der DotNet-Blog Alles rund um Microsoft .NET – von  Sascha H. Baumann

Artikel mit ‘MCTS’ getagged

MCTS Exam 70-536 – Reading and Writing Streams and Files

Dienstag, 06. Oktober 2009

Good Morning folks,

Today I read about streams and files, and as usual I provide my notes as a summary. enjoy !

Textfiles

  • To read a textfile, we can use TextReader or StreamReader Class
  • To write a textfile, we can use TextWriter or StreamWriter Class
  • StreamReader derives from TextReader
  • Usually you use File.OpenText or StreamReader Constructor
  • Typically we use ReadLine or ReadToEnd Methods to read data
  • Dont forget to call Close on the Reader or Writer after finished reading or writing
  • To ensure, that no data is left in the buffer while keeping the file open use the Flush Method

Binary Files

  • To read and write binary files, use BinaryReader and BinaryWriter
  • Generally serialization is more effective

Strings

  • Use StringWriter to write data to StringBuilder
  • Not used very often, only in special scenarios

MemoryStream

  • To create a stream in memory
  • Commonly used to store data temporarily that will be written to a file eventually
  • To Minimize the time a file is locked open, minimizes the potential for conflict
  • MemoryStream often is used with a StreamWriter, cause MS itself has only WriteByte/Write, and ReadByte/Read Methods that work with bytes and byte-arrays

BufferedStream

  • Is used for custom stream implements
  • .NET Stream Classes have a build-in buffering logic, so you normally dont need to use BufferedStream. If you do so its redundant and inefficent

Compressed Streams

  • You can only read or write bytes and byte-arrays directly, but you can use StreamWriter and StreamReader
  • Use GZipStream Class for GZIP-Compression and DeflatedStream class for Deflated Data Format
  • CompressionMode which is part of the constructor indicates simply if you are compressing or decompressing data

Isolated Storage

  • Isolated Storage is a private file system
  • It requires fewer privileges than writing to filesystem
  • IS is isolated by user, application domain and assembly
  • Don’t use to store high-value secrets or sensitive data, because its not protected from high-trusted code, unmanaged code or trusted users of the computer
  • The access to a file is restricted to the user who created it
  • isolation by application domain is optional
  • In most case (almost always) you will use the isolation by application-domain
  • Classes to work with Isolated Storage (All in System.IO.IsolatedStorage)
    1. IsolatedStorageFile – Management of Isolated Storage Stores (Often Used Methods are .GetUserStoreForAssembly, .GetUserStoreForDomain, .GetStore
    2. IsolatedStorageFileStream – Access to read/write Isolated Storage files
    3. IsolatedStorageException – exception related to Isolated Sotrage
  • Code must be granted IsolatedStorageFilePermission

MCTS Examen 70-536 – Filesystem

Freitag, 02. Oktober 2009

Hi there

We now leave types behind and go to the input/output chapter. I have to say, writing along while learning takes more time then just reading, but i hope it pays out at the end my having more information stuck in my brain ;o)

Drive Enumerating

  • Use DriveInfo.GetDrives to get a List of Drives connected to the system
  • You get a Collection over which you can loop
  • Available Information: AvailableFreeSpace, DriveFormat, DriveType, IsReady, Name, RootDirectory,TotalFreeSpace, TotalSize, VolumeLabel

Files and Folders

  • You can browse a folder by using an instance of DirectoyInfo and call .GetFiles or .GetDirectories
  • You can create a directory by using an instance of DirectoryInfo and call .Create
  • You can check if a directory Exists by DirectoryInfo.Exists
  • Static File Operations: File.Create, File.CreateText, File.Copy, File.Move, File.Delete
  • Alternative: Use an instance of FileInfo and call .Create, .CreateText, .CopyTo, .MoveTo, .Delete

Filesystem Monitoring

  • Use System.IO.FileSystemWatcher (responds to updated, new and renamed files etc)
  • FSW works Eventbased (Changed-Event, Create-Event, Delete-Event, Rename-Event etc.) and provides FileSystemEventArgs (except Rename, this provides RenamedEventArgs
  • You can configure the Watcher with:
    1. Filter (Filename, you can use wildcards)
    2. NotifyFilter (Defines, what changes causing a notification (One or more): Filename, Size, LastAccess etc)
    3. Path (Folder to be monitored)

MCTS Examen 70-536 – Common Reference Types

Montag, 21. September 2009

Hello everyone !


Hallo zusammen,

ein neuer Anlauf in Richtung Examen und die Entscheidung, die Blogsprache auf Englisch umzustellen, um schlichtweg mehr Leser anzusprechen. Ich hoffe, es stört nicht zu sehr :o )


During todays power-cut (don’t know what happened, just no electricity for half an hour) I decided to continue my journey toward Microsoft exam 70-735, the first step to become MCPD.

I will post a summary of any chapter I work through, therefore its not exactly for beginners, more like a little learning help for me and hopefully other people reading it. By the way, my language of choice is C#, so this is what you will read about.

(weiterlesen…)

MCTS Examen 70-536 – Value Types

Donnerstag, 29. Januar 2009

Objective: Manage data in a .NET Framework application by using .NET Framework system types – Teil 1

Guten Tag,

Heute geht es los mit der Prüfungsvorbereitung. Es sei mir zuerst ein Hinweis auf die Microsoft-eigene Webseite mit vielen wissenswerten Informationen zum Examen gestattet: Infos zum Examen 70-536 auf Microsoft.com

Meine gelernten Inhalte sind als zusammenfassende Stickpunkte verfasst. Wer sich ernsthaft auf die Prüfung vorbereiten will, kommt aber wohl nicht um die Anschaffung eines Buches herum. Ich empfehle folgendes: MCTS Self-Paced Training Kit von Tony Northrup

Microsoft bietet übrigens für begrenzte Zeit wieder das Zweite Chance Angebot. Hierbei bekommt man beim Durchfallen die Wiederholungsprüfung umsonst. Das Ganze gilt bis 30. Juni 2009

Viel Spaß, Sascha Baumann

(weiterlesen…)

MCTS Examen 70-536 – Ein Vorwort

Dienstag, 27. Januar 2009

Guten Morgen liebe Gemeinde,

Trotz vieler Jahre Erfahrung in der Entwicklung im .NET Framework habe ich eine offizielle Zertifizierung lange vor mir her geschoben. Ich denke das geht vielen so, die der täglichen Arbeit den Vorrang geben, und sich in ihrer knappen Freizeit nicht auch noch mit Programmierung beschäftigen wollen – denn schließlich ist eine gute Work/Life Balance sehr kostbar.

Letztendlich habe ich mich doch dazu entschlossen. Zum einen, weil ich immer wieder gerne neue Dinge lerne (und ich bin mir sicher, ich werde im Laufe der Vorbereitung noch das eine oder andere aufschnappen) zum anderen, weil es als Freiberufler wichtiger ist als in der Festanstellung, die eigenen Kenntnisse verbrieft vorliegen zu haben.

Meinen Fortschritt und meine Lerninhalte möchte ich mit euch teilen, und werde deshalb an dieser Stelle wöchentlich über den Fortgang berichten. Wer Lust hat mitzumachen, dem empfehle ich folgendes Buch: MCTS Self-Paced Training Kit von Tony Northrup

Ich kann natürlich keine Garantie dafür übernehmen, dass ein regelmäßiges Lesen meiner Beiträge automatisch zu einer bestandenen Prüfung führt (Genauso wenig wie ich weiß, ob das Schreiben der selbigen in einer bestandenen Prüfung resultiert ;o) ). Aber vielleicht macht es ja Lust, es selbst mal zu versuchen.

Bis spätestens Ende der Woche werde ich den ersten Artikel fertig haben, und hier posten. Stay Tuned …


Bad Behavior has blocked 35 access attempts in the last 7 days.