<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Code Snippets for common operations</title><link>http://blogs.msdn.com/b/erudition/archive/2007/12/20/code-snippets-for-common-operations.aspx</link><description>1. read all the contents of a File 
 string output = File.ReadAllText(&amp;lt;FilePath&amp;gt;); 
 2. Write contents to a File 
 File.WriteAllText(&amp;lt;FilePath&amp;gt;,Encoding); 
 3. Convert String to Byte Array 
 byte[] buf = System.Text.Encoding.&amp;lt;Encoding&amp;gt;</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: Code Snippets for common operations</title><link>http://blogs.msdn.com/b/erudition/archive/2007/12/20/code-snippets-for-common-operations.aspx#8471152</link><pubDate>Thu, 08 May 2008 14:24:30 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8471152</guid><dc:creator>erudition</dc:creator><description>&lt;p&gt;5. Copying one stream to another &lt;/p&gt;
&lt;p&gt;FileStream _fStream = new FileStream(@&amp;quot;&amp;lt;FilePath&amp;gt;&amp;quot;,FileMode.Open);&lt;/p&gt;
&lt;p&gt;MemoryStream _stream = new MemoryStream();&lt;/p&gt;
&lt;p&gt;byte[] buffer = new byte[1024];&lt;/p&gt;
&lt;p&gt;int nrBytesWritten = _fStream.Read(buffer, 0, 1024);&lt;/p&gt;
&lt;p&gt;while (nrBytesWritten &amp;gt; 0)&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;_stream.Write(buffer, 0, nrBytesWritten);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;nrBytesWritten = _fStream.Read(buffer, 0, 1024);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8471152" width="1" height="1"&gt;</description></item><item><title>MSDN Blog Postings  &amp;raquo; Code Snippets for common operations</title><link>http://blogs.msdn.com/b/erudition/archive/2007/12/20/code-snippets-for-common-operations.aspx#6815717</link><pubDate>Thu, 20 Dec 2007 13:34:23 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6815717</guid><dc:creator>MSDN Blog Postings  » Code Snippets for common operations</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://msdnrss.thecoderblogs.com/2007/12/20/code-snippets-for-common-operations/"&gt;http://msdnrss.thecoderblogs.com/2007/12/20/code-snippets-for-common-operations/&lt;/a&gt;&lt;/p&gt;
&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=6815717" width="1" height="1"&gt;</description></item></channel></rss>