<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments for C# and stuff</title>
	<atom:link href="http://blog.kjeldby.dk/?feed=comments-rss2" rel="self" type="application/rss+xml" />
	<link>http://blog.kjeldby.dk</link>
	<description>Patterns and best practices in software development ...</description>
	<lastBuildDate>Fri, 06 Aug 2010 17:46:18 +0200</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>Comment on Overflow, checked and unchecked by Kristoffer Brinch Kjeldby</title>
		<link>http://blog.kjeldby.dk/?p=84&#038;cpage=1#comment-263</link>
		<dc:creator>Kristoffer Brinch Kjeldby</dc:creator>
		<pubDate>Fri, 06 Aug 2010 17:46:18 +0000</pubDate>
		<guid isPermaLink="false">http://blog.kjeldby.dk/?p=84#comment-263</guid>
		<description>Hi Chunkit

Yeps - The check happens before the addition.

Regarding optimization I suspects that the compile will not replace a checked operation with an unchecked, when it is explicit written in the code even - if the check is redundant. I have not checked this however. I you want to go into the msil code, you can use the MSIL Disassembler (Ildasm.exe).

Regards Kristoffer</description>
		<content:encoded><![CDATA[<p>Hi Chunkit</p>
<p>Yeps &#8211; The check happens before the addition.</p>
<p>Regarding optimization I suspects that the compile will not replace a checked operation with an unchecked, when it is explicit written in the code even &#8211; if the check is redundant. I have not checked this however. I you want to go into the msil code, you can use the MSIL Disassembler (Ildasm.exe).</p>
<p>Regards Kristoffer</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Overflow, checked and unchecked by chunkit</title>
		<link>http://blog.kjeldby.dk/?p=84&#038;cpage=1#comment-260</link>
		<dc:creator>chunkit</dc:creator>
		<pubDate>Tue, 03 Aug 2010 02:53:43 +0000</pubDate>
		<guid isPermaLink="false">http://blog.kjeldby.dk/?p=84#comment-260</guid>
		<description>I made a mistake in my previous comment. b &lt; 255 is correct.</description>
		<content:encoded><![CDATA[<p>I made a mistake in my previous comment. b &lt; 255 is correct.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Overflow, checked and unchecked by chunkit</title>
		<link>http://blog.kjeldby.dk/?p=84&#038;cpage=1#comment-259</link>
		<dc:creator>chunkit</dc:creator>
		<pubDate>Tue, 03 Aug 2010 02:29:45 +0000</pubDate>
		<guid isPermaLink="false">http://blog.kjeldby.dk/?p=84#comment-259</guid>
		<description>The third code should be i &lt; 256 and b &lt; 256.
Depending on what you want, you may want to throw an exception if !(b &lt; 256).

I guess the performance penalty for using checked is that it checks both b++ and i++, but I can&#039;t be sure unless I look into the msil code (haven&#039;t learnt to do that yet). Perhaps a good compiler will optimize away the checking on integral variables that can be determined at compile-time never to cause an OverflowException.</description>
		<content:encoded><![CDATA[<p>The third code should be i &lt; 256 and b &lt; 256.<br />
Depending on what you want, you may want to throw an exception if !(b &lt; 256).</p>
<p>I guess the performance penalty for using checked is that it checks both b++ and i++, but I can&#039;t be sure unless I look into the msil code (haven&#039;t learnt to do that yet). Perhaps a good compiler will optimize away the checking on integral variables that can be determined at compile-time never to cause an OverflowException.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Microsoft Team Foundation Server: Moving from Visual Source Safe by Nick Yilmaz</title>
		<link>http://blog.kjeldby.dk/?p=302&#038;cpage=1#comment-258</link>
		<dc:creator>Nick Yilmaz</dc:creator>
		<pubDate>Sat, 31 Jul 2010 20:22:19 +0000</pubDate>
		<guid isPermaLink="false">http://blog.kjeldby.dk/?p=302#comment-258</guid>
		<description>Is it possible to control version of programs with TFS? For instance, a student submits a source code of project to the teacher and the teacher respond back to student with comment in the program.</description>
		<content:encoded><![CDATA[<p>Is it possible to control version of programs with TFS? For instance, a student submits a source code of project to the teacher and the teacher respond back to student with comment in the program.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Microsoft Team Foundation Server: Moving from Visual Source Safe by Kristoffer Brinch Kjeldby</title>
		<link>http://blog.kjeldby.dk/?p=302&#038;cpage=1#comment-227</link>
		<dc:creator>Kristoffer Brinch Kjeldby</dc:creator>
		<pubDate>Wed, 05 May 2010 16:08:54 +0000</pubDate>
		<guid isPermaLink="false">http://blog.kjeldby.dk/?p=302#comment-227</guid>
		<description>Thanks! TFS 2010 is so much easier to handle!</description>
		<content:encoded><![CDATA[<p>Thanks! TFS 2010 is so much easier to handle!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Microsoft Team Foundation Server: Moving from Visual Source Safe by Lani</title>
		<link>http://blog.kjeldby.dk/?p=302&#038;cpage=1#comment-226</link>
		<dc:creator>Lani</dc:creator>
		<pubDate>Wed, 05 May 2010 11:14:52 +0000</pubDate>
		<guid isPermaLink="false">http://blog.kjeldby.dk/?p=302#comment-226</guid>
		<description>Very well written and informative article. It was nice to get your thoughts on this as we currently are evaluating TFS 2010. Thank you.</description>
		<content:encoded><![CDATA[<p>Very well written and informative article. It was nice to get your thoughts on this as we currently are evaluating TFS 2010. Thank you.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Paths in User Controls by Daniel Ballinger</title>
		<link>http://blog.kjeldby.dk/?p=17&#038;cpage=1#comment-210</link>
		<dc:creator>Daniel Ballinger</dc:creator>
		<pubDate>Fri, 09 Apr 2010 02:09:06 +0000</pubDate>
		<guid isPermaLink="false">http://blog.kjeldby.dk/?p=17#comment-210</guid>
		<description>When using a HTML server control setting the AppRelativeTemplateSourceDirectory property can resolve the path to a directory outside the user controls path.</description>
		<content:encoded><![CDATA[<p>When using a HTML server control setting the AppRelativeTemplateSourceDirectory property can resolve the path to a directory outside the user controls path.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Rotation around an vector in C#/XNA by Kristoffer Brinch Kjeldby</title>
		<link>http://blog.kjeldby.dk/?p=3&#038;cpage=1#comment-102</link>
		<dc:creator>Kristoffer Brinch Kjeldby</dc:creator>
		<pubDate>Thu, 26 Nov 2009 18:55:50 +0000</pubDate>
		<guid isPermaLink="false">http://blog.kjeldby.dk/?p=3#comment-102</guid>
		<description>Here is some psedo code:
&lt;code&gt;
Vector 2D Rotate(Vector2D p, Vector2D o, Degrees d)
{
&#160;&#160;var r = new Vector2D();
&#160;&#160;r.X = o.X+cos(d)*(p.X-o.X)
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;-sin(d)*(p.Y-o.Y);
&#160;&#160;r.Y = o.Y+sin(d)*(p.X-o.X)
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;+cos(d)*(p.Y-o.Y);
&#160;return r;
}
&lt;/code&gt;
p is the vector you want to rotate, o is the center around which you want to rotate and d is the degrees.

You can read more here: http://gpwiki.org/index.php/VB:Rotating_A_Point_In_2D</description>
		<content:encoded><![CDATA[<p>Here is some psedo code:<br />
<code><br />
Vector 2D Rotate(Vector2D p, Vector2D o, Degrees d)<br />
{<br />
&nbsp;&nbsp;var r = new Vector2D();<br />
&nbsp;&nbsp;r.X = o.X+cos(d)*(p.X-o.X)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-sin(d)*(p.Y-o.Y);<br />
&nbsp;&nbsp;r.Y = o.Y+sin(d)*(p.X-o.X)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+cos(d)*(p.Y-o.Y);<br />
&nbsp;return r;<br />
}<br />
</code><br />
p is the vector you want to rotate, o is the center around which you want to rotate and d is the degrees.</p>
<p>You can read more here: <a href="http://gpwiki.org/index.php/VB:Rotating_A_Point_In_2D" rel="nofollow">http://gpwiki.org/index.php/VB:Rotating_A_Point_In_2D</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Rotation around an vector in C#/XNA by Mayur</title>
		<link>http://blog.kjeldby.dk/?p=3&#038;cpage=1#comment-99</link>
		<dc:creator>Mayur</dc:creator>
		<pubDate>Sat, 21 Nov 2009 09:35:53 +0000</pubDate>
		<guid isPermaLink="false">http://blog.kjeldby.dk/?p=3#comment-99</guid>
		<description>Thats an excellent post.. However i would like to know wht i&#039;ll changes wld i have to make to make it work for a 2-D matrix.
What i need is the implementation of Matrix.Rotate() method of WPF in Silverlight, since silverlight does not have any inbuilt method for matrix rotation.</description>
		<content:encoded><![CDATA[<p>Thats an excellent post.. However i would like to know wht i&#8217;ll changes wld i have to make to make it work for a 2-D matrix.<br />
What i need is the implementation of Matrix.Rotate() method of WPF in Silverlight, since silverlight does not have any inbuilt method for matrix rotation.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Strings the right way by Kristoffer</title>
		<link>http://blog.kjeldby.dk/?p=21&#038;cpage=1#comment-59</link>
		<dc:creator>Kristoffer</dc:creator>
		<pubDate>Sun, 05 Jul 2009 22:39:02 +0000</pubDate>
		<guid isPermaLink="false">http://blog.kjeldby.dk/?p=21#comment-59</guid>
		<description>Hi Suiden 

Thanks for your comments. You right a long way here, but in my exact example:

string s1 = &quot;Hello&quot;;
s1 = s1 + &quot; world&quot;;

Even an optimized compilation produces the following MSIL:

.locals init ([0] string s1)
ldstr      &quot;Hello&quot;
stloc.0
ldloc.0
ldstr &quot; world&quot;
call string [mscorlib]System.String::Concat(string, string)
stloc.0

Now, I am not even close to being a IL expert - but this MSIL code is not optimized in the way you describe.

The string &quot;Hello&quot; is pushed onto the stack, and is location stored in the local variable 0 (s1) - then after the concat have been performed (and the result stored on the stack), variable 0 is redirected to the new location.

The pivotal point is, that I create s1 as a named variable first. If i instead write:

s1 = &quot; Hello&quot; + &quot; world&quot;;

or 

s1 = String.Concat(&quot;Hello&quot;, &quot; world&quot;);

Only one string is created. So you are right concerning my last example with Concat.</description>
		<content:encoded><![CDATA[<p>Hi Suiden </p>
<p>Thanks for your comments. You right a long way here, but in my exact example:</p>
<p>string s1 = &#8220;Hello&#8221;;<br />
s1 = s1 + &#8221; world&#8221;;</p>
<p>Even an optimized compilation produces the following MSIL:</p>
<p>.locals init ([0] string s1)<br />
ldstr      &#8220;Hello&#8221;<br />
stloc.0<br />
ldloc.0<br />
ldstr &#8221; world&#8221;<br />
call string [mscorlib]System.String::Concat(string, string)<br />
stloc.0</p>
<p>Now, I am not even close to being a IL expert &#8211; but this MSIL code is not optimized in the way you describe.</p>
<p>The string &#8220;Hello&#8221; is pushed onto the stack, and is location stored in the local variable 0 (s1) &#8211; then after the concat have been performed (and the result stored on the stack), variable 0 is redirected to the new location.</p>
<p>The pivotal point is, that I create s1 as a named variable first. If i instead write:</p>
<p>s1 = &#8221; Hello&#8221; + &#8221; world&#8221;;</p>
<p>or </p>
<p>s1 = String.Concat(&#8220;Hello&#8221;, &#8221; world&#8221;);</p>
<p>Only one string is created. So you are right concerning my last example with Concat.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
