<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	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/"
	>

<channel>
	<title>meh &#187; C#</title>
	<atom:link href="http://www.bonf.net/category/coding/c/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bonf.net</link>
	<description>-__-</description>
	<lastBuildDate>Sun, 11 Jul 2010 17:51:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Create C# Documentation Using Sandcastle</title>
		<link>http://www.bonf.net/2009/03/04/create-c-documentation-using-sandcastle/</link>
		<comments>http://www.bonf.net/2009/03/04/create-c-documentation-using-sandcastle/#comments</comments>
		<pubDate>Wed, 04 Mar 2009 14:10:42 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[documentation]]></category>
		<category><![CDATA[sandcastle]]></category>

		<guid isPermaLink="false">http://www.bonf.net/?p=76</guid>
		<description><![CDATA[Tomorrow I&#8217;m handing in my final project for my CS studies. This project is built in C#, and I was looking for a way to automatically create documentation that will aid browsing and understanding the main classes and their functions. A friend had told me about Sandcastle and I looked it up. Sandcastle is a [...]]]></description>
			<content:encoded><![CDATA[<p>Tomorrow I&#8217;m handing in my final project for my CS studies. This project is built in C#, and I was looking for a way to automatically create documentation that will aid browsing and understanding the main classes and their functions.</p>
<p>A friend had told me about Sandcastle and I looked it up. <a href="http://sandcastle.codeplex.com/">Sandcastle</a> is a project by Microsoft, that is intended to create MSDN-style documentation from .NET assemblies&#8230;</p>
<p><span id="more-76"></span>I had managed to achieve my goal quite easily using Sandcastle, and I thought about sharing my experience to serve other people as a guide. This is just a quick write-up of what I did &#8211; I did not read Sandcastle&#8217;s documentation and I believe that I don&#8217;t know how to operate it to its full potential.</p>
<ol>
<li>The first step is to <a href="http://sandcastle.codeplex.com/">download</a> and install Sandcastle.</li>
<li>Next, if you haven&#8217;t done it already, you have to tell Visual Studio to build XML documentation files. This parses all your comments ( in the C# format ///&lt;summary&gt; etc&#8230;) and creates an XML file that we will feed into Sandcastle. To enable XML documentation, you have to go to Proect-&gt;(Project Name) Properties&#8230; and tick the relevant checkbox in the Build menu:<img class="alignnone size-full wp-image-77" title="builddoc" src="http://www.bonf.net/wp-content/uploads/2009/03/builddoc.png" alt="builddoc" width="790" height="666" /></li>
<li>We will now launch the Sandcastle GUI application, located in C:\Program Files\Sandcastle\Examples\generic ( replace C:\Program Files with wherever you had installed Sandcastle).</li>
<li>Add your assemblies (exe/dll) and XML comments file to the relevant list boxes and choose the desired output format. Enter you project name under &#8220;Name&#8221;.</li>
<li>Hit &#8220;Build&#8221;. The build process can take a while, and it may seem like the program is frozen, but it&#8217;s not.</li>
<li>Your documentation files should now be ready in  C:\Program Files\Sandcastle\Examples\Your Project Name</li>
<li>If you chose CHM as an output format, you will now have to compile the CHM file. To do this you need to download and install <a href="http://www.microsoft.com/downloads/details.aspx?familyid=00535334-c8a6-452f-9aa0-d597d16580cc&amp;displaylang=en">Microsoft HTML Help Workshop</a></li>
<li>After installing HTML Help Workshop, you will have to run hhc.exe (from the directory where you installed it). hhc takes an hhp (HTML Help Project) file as an argument. Sandcastle has created this hhp file for you, and it should be in your Sandcastle project directory. Just run &#8220;hhc yourproject.hhp&#8221; and this will produce a CHM file in the project&#8217;s directory.</li>
</ol>
<p>That&#8217;s it. You should now have your compiled CHM help file with nice MSDN-style documentation.</p>
<p>As I mentioned earlier, I don&#8217;t really know Sandcastle and will be happy to get some tips in the comments section if you have any.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bonf.net/2009/03/04/create-c-documentation-using-sandcastle/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Generating Random Unicode Strings in C#</title>
		<link>http://www.bonf.net/2009/01/14/generating-random-unicode-strings-in-c/</link>
		<comments>http://www.bonf.net/2009/01/14/generating-random-unicode-strings-in-c/#comments</comments>
		<pubDate>Wed, 14 Jan 2009 21:05:41 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[random]]></category>
		<category><![CDATA[unicode]]></category>

		<guid isPermaLink="false">http://www.bonf.net/?p=46</guid>
		<description><![CDATA[I have to admit this is quite a dull subject, but I thought it might help some guys( and gals! ) out there. I am working on a C# project for uni, and while fighting some pesky bugs, I decided I should get more organized and have a small &#8220;unit testing&#8221; framework built for it. [...]]]></description>
			<content:encoded><![CDATA[<p>I have to admit this is quite a dull subject, but I thought it might help some guys( and gals! ) out there.</p>
<p>I am working on a C# project for uni, and while fighting some pesky bugs, I decided I should get more organized and have a small &#8220;unit testing&#8221; framework built for it.</p>
<p>I had a need for random generated Unicode strings, and quick googling turned up no results. Instead of doing some broaded searching, I decided I could learn more by writing my own code:<br />
<span id="more-46"></span></p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #FF0000;">class</span> RandomUnicodeString
    <span style="color: #000000;">&#123;</span>
        <span style="color: #0600FF;">private</span> Random _r<span style="color: #008000;">;</span>
&nbsp;
        <span style="color: #0600FF;">public</span> RandomUnicodeString<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
            _r <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Random<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #000000;">&#125;</span>
&nbsp;
        <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">string</span> GetString<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">int</span> length<span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
            <span style="color: #FF0000;">byte</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> str <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> <span style="color: #FF0000;">byte</span><span style="color: #000000;">&#91;</span>length <span style="color: #008000;">*</span> <span style="color: #FF0000;">2</span><span style="color: #000000;">&#93;</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #0600FF;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">int</span> i <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">;</span> i <span style="color: #008000;">&lt;</span> length <span style="color: #008000;">*</span> <span style="color: #FF0000;">2</span> <span style="color: #008000;">;</span> i<span style="color: #008000;">+=</span><span style="color: #FF0000;">2</span><span style="color: #000000;">&#41;</span>
            <span style="color: #000000;">&#123;</span>
                <span style="color: #FF0000;">int</span> chr <span style="color: #008000;">=</span> _r.<span style="color: #0000FF;">Next</span><span style="color: #000000;">&#40;</span>0xD7FF<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
                str<span style="color: #000000;">&#91;</span>i<span style="color: #008000;">+</span><span style="color: #FF0000;">1</span><span style="color: #000000;">&#93;</span> <span style="color: #008000;">=</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">byte</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>chr <span style="color: #008000;">&amp;</span> 0xFF00<span style="color: #000000;">&#41;</span> <span style="color: #008000;">&gt;&gt;</span> <span style="color: #FF0000;">8</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
                str<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span> <span style="color: #008000;">=</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">byte</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#40;</span>chr <span style="color: #008000;">&amp;</span> 0xFF<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #000000;">&#125;</span>
&nbsp;
            <span style="color: #0600FF;">return</span> Encoding.<span style="color: #0000FF;">Unicode</span>.<span style="color: #0000FF;">GetString</span><span style="color: #000000;">&#40;</span>str<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #000000;">&#125;</span>
    <span style="color: #000000;">&#125;</span></pre></div></div>

<p>At first I had the string generation in the constructor, but it caused repeated strings, as I was using it in a loop, and newly created <em>Random</em> objects were using the same seed. More on this can be found in <a href="http://www.guyrutenberg.com/2007/09/03/seeding-srand/">Guy&#8217;s blog</a>.</p>
<p>If you want to limit the string to be of a specific language, there&#8217;s a reference of unicode mapping on <a href="http://en.wikipedia.org/wiki/Basic_Multilingual_Plane">Wikipedia</a>, just change _r.Next to use those limits.</p>
<p>There&#8217;s probably a better way for converting bytes to unicode chars, and this may not work on a little/big endian machine, but I don&#8217;t know enough about C# to tell for sure.</p>
<p>If you got here from google and this solved your coding problem, please post a comment ! =)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bonf.net/2009/01/14/generating-random-unicode-strings-in-c/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
