<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>DotNetBlog der DotNet-Blog</title>
	
	<link>http://dotnetblog.saschabaumann.com</link>
	<description>Alles rund um Microsoft .NET - von  Sascha H. Baumann</description>
	<lastBuildDate>Tue, 09 Mar 2010 13:59:07 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/DotnetblogDerDotnet-blog" /><feedburner:info uri="dotnetblogderdotnet-blog" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>DotnetblogDerDotnet-blog</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>C#: Lookup vs. Dictionary</title>
		<link>http://feedproxy.google.com/~r/DotnetblogDerDotnet-blog/~3/aZwVKPHys4I/</link>
		<comments>http://dotnetblog.saschabaumann.com/2010/02/c-loopup-vs-dictionary/#comments</comments>
		<pubDate>Tue, 16 Feb 2010 16:42:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Allgemein]]></category>

		<guid isPermaLink="false">http://dotnetblog.saschabaumann.com/2010/02/c-loopup-vs-dictionary/</guid>
		<description><![CDATA[The main difference between the Generic Classes Lookup and Dictionary is the uniqueness of the Key. While Dictionarys can only have a Key-Value once,
in Lookup it can occur multiple times.
Declaration is the same.
Lookup&#60;int,string&#62; myLookup = new Lookup&#60;int,string&#62;();
vs.
Dictionary&#60;int,string&#62; myDic = new Dictionary&#60;int,string&#62;();
Furter Reading:
* A nice article about using ToDictionary and ToLookup in Linq can be found [...]]]></description>
			<content:encoded><![CDATA[<p>The main difference between the Generic Classes Lookup and Dictionary is the uniqueness of the Key. While Dictionarys can only have a Key-Value once,<br />
in Lookup it can occur multiple times.</p>
<p>Declaration is the same.</p>
<p>Lookup&lt;int,string&gt; myLookup = new Lookup&lt;int,string&gt;();</p>
<p>vs.</p>
<p>Dictionary&lt;int,string&gt; myDic = new Dictionary&lt;int,string&gt;();</p>
<p>Furter Reading:</p>
<p>* A nice article about using ToDictionary and ToLookup in Linq can be found <a href="http://blog.donnfelker.com/2010/02/12/linq-tolookup-vs-todictionary/" target="_blank">@blog.donnfelker.com</a></p>
<img src="http://feeds.feedburner.com/~r/DotnetblogDerDotnet-blog/~4/aZwVKPHys4I" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://dotnetblog.saschabaumann.com/2010/02/c-loopup-vs-dictionary/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://dotnetblog.saschabaumann.com/2010/02/c-loopup-vs-dictionary/</feedburner:origLink></item>
		<item>
		<title>Die Kultur de ist neutral. Sie kann nicht als die aktuelle Threadkultur festgelegt werden, da sie nicht zum Formatieren und Analysieren verwendet werden kann</title>
		<link>http://feedproxy.google.com/~r/DotnetblogDerDotnet-blog/~3/pD8aQcmtO5E/</link>
		<comments>http://dotnetblog.saschabaumann.com/2010/01/die-kultur-de-ist-neutral-sie-kann-nicht-als-die-aktuelle-threadkultur-festgelegt-werden-da-sie-nicht-zum-formatieren-und-analysieren-verwendet-werden-kann/#comments</comments>
		<pubDate>Thu, 14 Jan 2010 10:46:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Allgemein]]></category>

		<guid isPermaLink="false">http://dotnetblog.saschabaumann.com/2010/01/die-kultur-de-ist-neutral-sie-kann-nicht-als-die-aktuelle-threadkultur-festgelegt-werden-da-sie-nicht-zum-formatieren-und-analysieren-verwendet-werden-kann/</guid>
		<description><![CDATA[I got this message yesterday, while trying to save changes into entity framework. the whole thing was within an ASHX-Handler and I couldn’t figure out , what the deal was.
Now I found a solutions. Just add the following line at the beginning of your method /codeblock and you are fine:
 C#    
System.Threading.Thread.CurrentThread.CurrentUICulture [...]]]></description>
			<content:encoded><![CDATA[<p>I got this message yesterday, while trying to save changes into entity framework. the whole thing was within an ASHX-Handler and I couldn’t figure out , what the deal was.</p>
<p>Now I found a solutions. Just add the following line at the beginning of your method /codeblock and you are fine:</p>
<p> <b>C#</b>   <br /> 
<p>System.Threading.Thread.CurrentThread.CurrentUICulture =   <br />&#160;&#160;&#160;&#160; new System.Globalization.CultureInfo(&quot;de-DE&quot;);</p>
<p> <b>VB.net</b>   <br /> 
<p>System.Threading.Thread.CurrentThread.CurrentUICulture = _   <br />&#160;&#160;&#160;&#160; New System.Globalization.CultureInfo(&quot;de-DE&quot;)</p>
<img src="http://feeds.feedburner.com/~r/DotnetblogDerDotnet-blog/~4/pD8aQcmtO5E" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://dotnetblog.saschabaumann.com/2010/01/die-kultur-de-ist-neutral-sie-kann-nicht-als-die-aktuelle-threadkultur-festgelegt-werden-da-sie-nicht-zum-formatieren-und-analysieren-verwendet-werden-kann/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://dotnetblog.saschabaumann.com/2010/01/die-kultur-de-ist-neutral-sie-kann-nicht-als-die-aktuelle-threadkultur-festgelegt-werden-da-sie-nicht-zum-formatieren-und-analysieren-verwendet-werden-kann/</feedburner:origLink></item>
		<item>
		<title>Extension Methods in VB.Net</title>
		<link>http://feedproxy.google.com/~r/DotnetblogDerDotnet-blog/~3/08qCGQeag4E/</link>
		<comments>http://dotnetblog.saschabaumann.com/2010/01/extension-methods-in-vbnet/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 15:07:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Allgemein]]></category>

		<guid isPermaLink="false">http://dotnetblog.saschabaumann.com/2010/01/extension-methods-in-vbnet/</guid>
		<description><![CDATA[My preferred .NET-language is C#, but as a consultant I have to write VB every once in a while. Here is a little introduction, how my beloved    Extension Methods work in VB.Net.
 
Just two steps:
Step1 – Create a new Module called for example “StringExtensions.vb” and add an Import –Statement for System.Runtime.CompilerServices
Step2 – [...]]]></description>
			<content:encoded><![CDATA[<p>My preferred .NET-language is C#, but as a consultant I have to write VB every once in a while. Here is a little introduction, how my beloved    <br />Extension Methods work in VB.Net.</p>
<p> <!-- more -->
<p><b>Just two steps:</b></p>
<p>Step1 – Create a new Module called for example “StringExtensions.vb” and add an Import –Statement for System.Runtime.CompilerServices</p>
<p>Step2 – Write your Extension Method, and put an &lt;Extension()&gt; directive on top. Here is an example:</p>
<pre land="c#">
&lt;Extension()> _
    Public Function AddAbcX(ByVal mystring As String) As String
        Return myString + "ABC"
    End Function
</pre>
<p><b>Notice the _ behind the directive. Don&#8217;t forget this one.</b></p>
<p>
You notive one additional thing. A while ago I read an article about Extension Methods and got the suggestion to add an X to each methodname.<br />
So, if using intellisense, you will see directly if the method you&#8217;re about to call is an Extension Method or a build-in Method. Good idea I think.
</p>
<p>
Another suggestion &#8211; Put the method in the same namespace as the object it belongs to (I said namespace, not file!).<br />
<br/>So you have your methods ready when you start using the object.</p>
<p>
Cheers<br/><br />
Sascha</p>
<img src="http://feeds.feedburner.com/~r/DotnetblogDerDotnet-blog/~4/08qCGQeag4E" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://dotnetblog.saschabaumann.com/2010/01/extension-methods-in-vbnet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://dotnetblog.saschabaumann.com/2010/01/extension-methods-in-vbnet/</feedburner:origLink></item>
		<item>
		<title>Happy new Year</title>
		<link>http://feedproxy.google.com/~r/DotnetblogDerDotnet-blog/~3/lNAg33mycEA/</link>
		<comments>http://dotnetblog.saschabaumann.com/2009/12/frohes-neues-jahr/#comments</comments>
		<pubDate>Thu, 31 Dec 2009 11:00:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Allgemein]]></category>

		<guid isPermaLink="false">http://dotnetblog.saschabaumann.com/2009/12/frohes-neues-jahr/</guid>
		<description><![CDATA[Hello everyone,
I wish all of you a relaxing and successful 2010. See you on the other side  )
Sascha
]]></description>
			<content:encoded><![CDATA[<p>Hello everyone,</p>
<p>I wish all of you a relaxing and successful 2010. See you on the other side <img src='http://dotnetblog.saschabaumann.com/wp-includes/images/smilies/icon_surprised.gif' alt=':o' class='wp-smiley' /> )</p>
<p>Sascha</p>
<img src="http://feeds.feedburner.com/~r/DotnetblogDerDotnet-blog/~4/lNAg33mycEA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://dotnetblog.saschabaumann.com/2009/12/frohes-neues-jahr/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://dotnetblog.saschabaumann.com/2009/12/frohes-neues-jahr/</feedburner:origLink></item>
		<item>
		<title>Silverlight 4 Beta released</title>
		<link>http://feedproxy.google.com/~r/DotnetblogDerDotnet-blog/~3/SnqEGrcIy1A/</link>
		<comments>http://dotnetblog.saschabaumann.com/2009/11/silverlight-4-beta-released/#comments</comments>
		<pubDate>Sun, 22 Nov 2009 21:33:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Allgemein]]></category>

		<guid isPermaLink="false">http://dotnetblog.saschabaumann.com/2009/11/silverlight-4-beta-released/</guid>
		<description><![CDATA[As you might now, Microsoft has released the first beta for Silverlight 4 a few days ago. More about this beta, and other Silverlight related topics can be found on my Blog about Silverlight.
Cheers
Sascha
]]></description>
			<content:encoded><![CDATA[<p>As you might now, Microsoft has released the first beta for Silverlight 4 a few days ago. More about this beta, and other Silverlight related topics can be found on my <a href="http://blog.SilverlightDeveloper.de" target="_blank">Blog about Silverlight</a>.</p>
<p>Cheers</p>
<p>Sascha</p>
<img src="http://feeds.feedburner.com/~r/DotnetblogDerDotnet-blog/~4/SnqEGrcIy1A" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://dotnetblog.saschabaumann.com/2009/11/silverlight-4-beta-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://dotnetblog.saschabaumann.com/2009/11/silverlight-4-beta-released/</feedburner:origLink></item>
		<item>
		<title>Visual Studio 2010 and .NET 4.0 Beta 2 now available for the public</title>
		<link>http://feedproxy.google.com/~r/DotnetblogDerDotnet-blog/~3/qe3BOYMbFbk/</link>
		<comments>http://dotnetblog.saschabaumann.com/2009/10/visual-studio-2010-and-net-40-beta-2-now-available-for-the-public/#comments</comments>
		<pubDate>Wed, 21 Oct 2009 12:00:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[.NET Future]]></category>
		<category><![CDATA[Allgemein]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[Beta]]></category>
		<category><![CDATA[Visual Studio 2010]]></category>

		<guid isPermaLink="false">http://dotnetblog.saschabaumann.com/?p=386</guid>
		<description><![CDATA[Hello everyone,
I just checked, and found that now everyone can download the new Beta 2 of VS2010 and .NET Framework 4. Have fun trying, I know I will.
Download: Microsofts Visual Studio Page
]]></description>
			<content:encoded><![CDATA[<p>Hello everyone,</p>
<p>I just checked, and found that now everyone can download the new Beta 2 of VS2010 and .NET Framework 4. Have fun trying, I know I will.</p>
<p>Download: <a href="http://www.microsoft.com/visualstudio/en-us/products/2010/default.mspx" target="_blank" title="Visual Studio 2010 and .NET Framework 4 Beta 2">Microsofts Visual Studio Page</a></p>
<img src="http://feeds.feedburner.com/~r/DotnetblogDerDotnet-blog/~4/qe3BOYMbFbk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://dotnetblog.saschabaumann.com/2009/10/visual-studio-2010-and-net-40-beta-2-now-available-for-the-public/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://dotnetblog.saschabaumann.com/2009/10/visual-studio-2010-and-net-40-beta-2-now-available-for-the-public/</feedburner:origLink></item>
		<item>
		<title>MCTS Exam 70-536 – Generic Collections</title>
		<link>http://feedproxy.google.com/~r/DotnetblogDerDotnet-blog/~3/9WFAIetZ_mQ/</link>
		<comments>http://dotnetblog.saschabaumann.com/2009/10/mcts-exam-70-536-generic-collections/#comments</comments>
		<pubDate>Thu, 15 Oct 2009 07:00:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Allgemein]]></category>

		<guid isPermaLink="false">http://dotnetblog.saschabaumann.com/?p=376</guid>
		<description><![CDATA[Good News everyone !
For the fact that I&#8217;m faster in reading then in wring, I made a lot of progress in exam preparation and I&#8217;m a bit behind with my notes. Anyway, I share my notes about this topic with you today
General

Using Generics can improve performance by reducing the number of cast-operations.
Common generic Collections:

List&#60;T&#62; Comparable [...]]]></description>
			<content:encoded><![CDATA[<p>Good News everyone !</p>
<p>For the fact that I&#8217;m faster in reading then in wring, I made a lot of progress in exam preparation and I&#8217;m a bit behind with my notes. Anyway, I share my notes about this topic with you today</p>
<h3>General</h3>
<ul>
<li>Using Generics can improve performance by reducing the number of cast-operations.</li>
<li>Common generic Collections:
<ol>
<li><b>List&lt;T&gt;</b> <br/>Comparable to StringCollection and ArrayList</li>
<li><b>Dictionary&lt;T,U&gt;</b> <br/>Comparable to NameValueCollection, StringDictionary,OrderedDictionary,HybridDictionary, ListDictionary and Hashtable</li>
<li><b>Queue&lt;T&gt;</b> <br/>Comparable to normal Queue</li>
<li><b>Stack&lt;T&gt;</b> <br/>Comparable to normal Stack</li>
<li><b>SortedList&lt;T, U&gt;</b> <br/>Comparable to normal SortedList</li>
<li><b>Collection&lt;T&gt;</b>  <br/>Comparable to CollectionBase</li>
<li><b>ReadOnlyCollection&lt;T&gt;</b> <br/> Comparable to ReadOnlyCollectionBase</li>
</ol>
</li>
<li>You can Use Generics with any build in and Custom Type</li>
<li>Is&#8217;nt there more ? Lots of code samples which are not part of my notes <img src='http://dotnetblog.saschabaumann.com/wp-includes/images/smilies/icon_surprised.gif' alt=':o' class='wp-smiley' /> )
</ul>
<img src="http://feeds.feedburner.com/~r/DotnetblogDerDotnet-blog/~4/9WFAIetZ_mQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://dotnetblog.saschabaumann.com/2009/10/mcts-exam-70-536-generic-collections/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://dotnetblog.saschabaumann.com/2009/10/mcts-exam-70-536-generic-collections/</feedburner:origLink></item>
		<item>
		<title>MCTS Exam 70-536 – Collections and Dictionaries</title>
		<link>http://feedproxy.google.com/~r/DotnetblogDerDotnet-blog/~3/rqi5z_bRE-I/</link>
		<comments>http://dotnetblog.saschabaumann.com/2009/10/mcts-exam-70-536-collections-and-dictionaries/#comments</comments>
		<pubDate>Sun, 11 Oct 2009 23:24:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Allgemein]]></category>

		<guid isPermaLink="false">http://dotnetblog.saschabaumann.com/?p=370</guid>
		<description><![CDATA[Good morning,
today I start with Collections and Dictionaries during my MCTS exam-preparation. As usual I provide my notes on that topic as a little help and motivation for other students.

Collections

namespaces where we find Collections are System.Collections and System.Collections.Specialized
Collectionstypes are:

ArrayList &#8211; stores any type of object, expands as required. Accessable by zero based index or within [...]]]></description>
			<content:encoded><![CDATA[<p>Good morning,</p>
<p>today I start with Collections and Dictionaries during my MCTS exam-preparation. As usual I provide my notes on that topic as a little help and motivation for other students.</p>
<p><!-- more--></p>
<h3>Collections</h3>
<ul>
<li>namespaces where we find Collections are System.Collections and System.Collections.Specialized</li>
<li>Collectionstypes are:
<ol>
<li><b>ArrayList</b> &#8211; stores any type of object, expands as required. Accessable by zero based index or within a foreach_loop. Use .Add, .AddRange, .Remove, .Insert and .Sort (Objects need to implement IComparable), .Reverse (Reverse current order)</li>
<li><b>Queue</b> &#8211; First in, First out (FIFO) collection. Use .Enqueue and .Dequeue to add and remove objects and .Peek to lookup an object on a specified position. Use .Clear to remove all objects</li>
<li><b>Stack</b> &#8211; Last in, First out (LIFO) collection. Use .Push and .Pop to add and remove objects and .Peek to loopup an object on a specified position. Use .Clear to remove all objects</li>
<li><b>StringCollection</b> &#8211; As ArrayList, but strongly typed for strings, does not support sorting</li>
<li><b>BitArray / BitVector</b> &#8211; Collection of boolean values. BitVector is limited to 32 bits, BitArray stores more.</li>
</ul>
</li>
<li>Thinking about IComparable, the method .CompareTo provides default sortorder while .Compare provides custom sortorder.</li>
</ul>
<h3>Dictionaries</h3>
<li>Dictionary-Types are:
<ol>
<li><b>Hashtable</b> &#8211; name/value pairs that can be retrieved by name and index</li>
<li><b>SortedList</b> &#8211; sorted automatically by key. Array of DictionaryEntry objects</li>
<li><b>StringDictionary</b> &#8211; Hashtable that is strongly typed to string</li>
<li><b>ListDictionary</b> &#8211; Dictionary optimized for less then 10 items</li>
<li><b>HybridDictionary</b> &#8211; Advantage of ListDictionary when less then 10 items, otherwise behaves like a Hashtable</li>
<li><b>NameValueCollection</b> &#8211; pairs of strings, accessable by index or name(key). Can store multiple values for the same key.</li>
</ol>
</li>
</ul>
<img src="http://feeds.feedburner.com/~r/DotnetblogDerDotnet-blog/~4/rqi5z_bRE-I" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://dotnetblog.saschabaumann.com/2009/10/mcts-exam-70-536-collections-and-dictionaries/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://dotnetblog.saschabaumann.com/2009/10/mcts-exam-70-536-collections-and-dictionaries/</feedburner:origLink></item>
		<item>
		<title>MCTS Exam 70-536 – Encoding and Decoding</title>
		<link>http://feedproxy.google.com/~r/DotnetblogDerDotnet-blog/~3/uFJSclZKYSk/</link>
		<comments>http://dotnetblog.saschabaumann.com/2009/10/mcts-exam-70-536-encoding-and-decoding/#comments</comments>
		<pubDate>Fri, 09 Oct 2009 13:08:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Allgemein]]></category>

		<guid isPermaLink="false">http://dotnetblog.saschabaumann.com/?p=366</guid>
		<description><![CDATA[Good Day,
normally I would write about Regular Expressions today, but I need a little bit more preparation on this topic. So I will skip it for now, and work on Encoding and Decoding.

General

ASCII (American Standard Code for Information Interchange) is the foundation of the encodings
ASCII is 7 bit (0-127)
It includes English letters in upper and [...]]]></description>
			<content:encoded><![CDATA[<p>Good Day,</p>
<p>normally I would write about Regular Expressions today, but I need a little bit more preparation on this topic. So I will skip it for now, and work on Encoding and Decoding.</p>
<p><!-- more--></p>
<h3>General</h3>
<ul>
<li>ASCII (American Standard Code for Information Interchange) is the foundation of the encodings</li>
<li>ASCII is 7 bit (0-127)</li>
<li>It includes English letters in upper and lower case, punctuation, numbers and some special characters</li>
<li>It does not include non-English characters</li>
<li>ANSI defined code pages for different character-sets using 8-bit (0-127 as ASCII, 128-255 special)</li>
<li>ASCII and ISO 8859 (ANSI) encodings are being replaced by Unicode, a massive code-page</li>
<li>Default of .NET Framework is Unicode UTF-16 (In some cases UTF-8)</li>
<li>System.Text namespace contains classes that provide encoding and decoding (UTF-32 encoding, UTF-16 encoding, UTF-8 encoding, ASCII encoding, ANSI/ISO encoding)</li>
<li>UTF-8 and UTF-7 are backward compatible with ASCII-Encoding, UTF-16 and UTF-32 are not.</li>
</ul>
<h3>Encoding classes</h3>
<ul>
<li>use System.Text.Encoding.GetEncoding to get a special encoding object</li>
<li>use Encoding.GetBytes to convert a Unicode string to its byte representation</li>
<li>To Explore Code Pages use Encoding.GetEncodings to get a list of EncodingInfo Objects which represent available encodings</li>
</ul>
<h3>Specify Encoding when reading or writing a file</h3>
<ul>
<li>Use the overload of the StreamWriter- and StreamReader-Constructor accepting Encoding-Object</li>
<li>Typically you don&#8217;t need to specify the encoding type when reading a file. Framework detects automatically.</li>
<li>For Example writing &#8220;Hello Kitty!!&#8221; to a file has the following sizes when choosing the encoding:
<ul>
<li>UTF-7 : 19 bytes</li>
<li>UTF-8 : 18 bytes</li>
<li>UTF-16: 32 bytes</li>
<li>UTF-32: 64 bytes</li>
</ul>
</li>
<li>Notepad can not read UTF-7 and UTF-32 files correctly</li>
</ul>
<p>So far for now, next time I learn about Collections and Generics<br />
<img src="http://feeds.feedburner.com/~r/DotnetblogDerDotnet-blog/~4/uFJSclZKYSk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://dotnetblog.saschabaumann.com/2009/10/mcts-exam-70-536-encoding-and-decoding/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://dotnetblog.saschabaumann.com/2009/10/mcts-exam-70-536-encoding-and-decoding/</feedburner:origLink></item>
		<item>
		<title>MCTS Exam 70-536 – Reading and Writing Streams and Files</title>
		<link>http://feedproxy.google.com/~r/DotnetblogDerDotnet-blog/~3/HR9NRhnu82g/</link>
		<comments>http://dotnetblog.saschabaumann.com/2009/10/mcts-exam-70-536-reading-and-writing-streams-and-files/#comments</comments>
		<pubDate>Tue, 06 Oct 2009 07:00:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Allgemein]]></category>
		<category><![CDATA[MCTS Examen 70-536]]></category>
		<category><![CDATA[Exam 70-536]]></category>
		<category><![CDATA[MCTS]]></category>

		<guid isPermaLink="false">http://dotnetblog.saschabaumann.com/?p=357</guid>
		<description><![CDATA[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 [...]]]></description>
			<content:encoded><![CDATA[<p>Good Morning folks,</p>
<p>Today I read about streams and files, and as usual I provide my notes as a summary. enjoy !</p>
<h3>Textfiles</h3>
<ul>
<li>To read a textfile, we can use TextReader or StreamReader Class</li>
<li>To write a textfile, we can use TextWriter or StreamWriter Class</li>
<li>StreamReader derives from TextReader</li>
<li>Usually you use File.OpenText or StreamReader Constructor</li>
<li>Typically we use ReadLine or ReadToEnd Methods to read data</li>
<li>Dont forget to call Close on the Reader or Writer after finished reading or writing</li>
<li>To ensure, that no data is left in the buffer while keeping the file open use the Flush Method</li>
</ul>
<h3>Binary Files</h3>
<ul>
<li>To read and write binary files, use BinaryReader and BinaryWriter</li>
<li>Generally serialization is more effective</li>
</ul>
<h3>Strings</h3>
<ul>
<li>Use StringWriter to write data to StringBuilder</li>
<li>Not used very often, only in special scenarios</li>
</ul>
<h3>MemoryStream</h3>
<ul>
<li>To create a stream in memory</li>
<li>Commonly used to store data temporarily that will be written to a file eventually</li>
<li>To Minimize the time a file is locked open, minimizes the potential for conflict</li>
<li>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</li>
</ul>
<h3>BufferedStream</h3>
<ul>
<li>Is used for custom stream implements</li>
<li>.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</li>
</ul>
<h3>Compressed Streams</h3>
<ul>
<li>You can only read or write bytes and byte-arrays directly, but you can use StreamWriter and StreamReader</li>
<li>Use GZipStream Class for GZIP-Compression and DeflatedStream class for Deflated Data Format</li>
<li>CompressionMode which is part of the constructor indicates simply if you are compressing or decompressing data</li>
</ul>
<h3>Isolated Storage</h3>
<ul>
<li>Isolated Storage is a private file system</li>
<li>It requires fewer privileges than writing to filesystem</li>
<li>IS is isolated by user, application domain and assembly</li>
<li>Don&#8217;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</li>
<li>The access to a file is restricted to the user who created it</li>
<li>isolation by application domain is optional</li>
<li>In most case (almost always) you will use the isolation by application-domain</li>
<li>Classes to work with Isolated Storage (All in <i>System.IO.IsolatedStorage</i>)
<ol>
<li><b>IsolatedStorageFile</b> &#8211; Management of Isolated Storage Stores (Often Used Methods are <i>.GetUserStoreForAssembly</i>, <i>.GetUserStoreForDomain</i>, <i>.GetStore</i> </li>
<li><b>IsolatedStorageFileStream</b> &#8211; Access to read/write Isolated Storage files</li>
<li><b>IsolatedStorageException</b> &#8211; exception related to Isolated Sotrage</li>
</ol>
</li>
<li>Code must be granted IsolatedStorageFilePermission</li>
</ul>
<img src="http://feeds.feedburner.com/~r/DotnetblogDerDotnet-blog/~4/HR9NRhnu82g" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://dotnetblog.saschabaumann.com/2009/10/mcts-exam-70-536-reading-and-writing-streams-and-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://dotnetblog.saschabaumann.com/2009/10/mcts-exam-70-536-reading-and-writing-streams-and-files/</feedburner:origLink></item>
	</channel>
</rss>
