<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://msmvps.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>Jon Skeet: Coding Blog - All Comments</title><link>http://msmvps.com/blogs/jon_skeet/default.aspx</link><description>C#, .NET, Java, software development etc
**This is my personal blog. The views expressed on these pages are mine alone and not those of my employer.**</description><dc:language>en</dc:language><generator>CommunityServer 2008 SP1 (Build: 30619.63)</generator><item><title>re: Mapping from a type to an instance of that type</title><link>http://msmvps.com/blogs/jon_skeet/archive/2008/10/08/mapping-from-a-type-to-an-instance-of-that-type.aspx#1650637</link><pubDate>Sun, 12 Oct 2008 18:18:01 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1650637</guid><dc:creator>skeet</dc:creator><description>&lt;p&gt;Pavel: I&amp;#39;ve had another look at KeyedByTypeCollection, and it does look somewhat like it, yes. It&amp;#39;s a shame the docs are so poor. (It&amp;#39;s really unclear what it&amp;#39;s actually doing to start with.)&lt;/p&gt;
&lt;p&gt;Personally I prefer the API of DictionaryByType - it makes it clearer what&amp;#39;s going on, IMO, and it doesn&amp;#39;t artificially implement the other collection interfaces (which can&amp;#39;t really express what&amp;#39;s going on cleanly). My class also has an interface close to the Dictionary API, with TryGetValue for example. (I&amp;#39;d have used an indexer instead of Get/Put, but they can&amp;#39;t be generic.)&lt;/p&gt;
&lt;p&gt;Worth knowing about, though - thanks.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1650637" width="1" height="1"&gt;</description></item><item><title>re: Mapping from a type to an instance of that type</title><link>http://msmvps.com/blogs/jon_skeet/archive/2008/10/08/mapping-from-a-type-to-an-instance-of-that-type.aspx#1650635</link><pubDate>Sun, 12 Oct 2008 17:06:35 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1650635</guid><dc:creator>Pavel Minaev</dc:creator><description>&lt;p&gt;TItem that you give is the common base type for all types in the collection. Naturally, you can just use Object if you don&amp;#39;t want any restrictions whatsoever (which is rare - more often, when you use such a thing as e.g. a factory class registry, you have some common base interface you want to enforce). But otherwise it&amp;#39;s precisely the same - the key for the item is its type as returned by GetType(), and there can only be one item of a given type. E.g.:&lt;/p&gt;
&lt;p&gt;using System;&lt;/p&gt;
&lt;p&gt;using System.Collections.Generic;&lt;/p&gt;
&lt;p&gt;static class Program&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;	static void Main()&lt;/p&gt;
&lt;p&gt;	{&lt;/p&gt;
&lt;p&gt;		var d = new KeyedByTypeCollection&amp;lt;object&amp;gt;();&lt;/p&gt;
&lt;p&gt;		d.Add(123);&lt;/p&gt;
&lt;p&gt;		d.Add(123.456);&lt;/p&gt;
&lt;p&gt;		d.Add(&amp;#39;x&amp;#39;);&lt;/p&gt;
&lt;p&gt;		d.Add(&amp;quot;foo&amp;quot;);&lt;/p&gt;
&lt;p&gt;		Console.WriteLine(d.Find&amp;lt;int&amp;gt;());&lt;/p&gt;
&lt;p&gt;		Console.WriteLine(d.Find&amp;lt;double&amp;gt;());&lt;/p&gt;
&lt;p&gt;		Console.WriteLine(d.Find&amp;lt;char&amp;gt;());&lt;/p&gt;
&lt;p&gt;		Console.WriteLine(d.Find&amp;lt;string&amp;gt;());&lt;/p&gt;
&lt;p&gt;		d.Remove&amp;lt;int&amp;gt;();&lt;/p&gt;
&lt;p&gt;		d.Remove&amp;lt;double&amp;gt;();&lt;/p&gt;
&lt;p&gt;		d.Remove&amp;lt;string&amp;gt;();&lt;/p&gt;
&lt;p&gt;		d.Add(&amp;#39;y&amp;#39;); // throws&lt;/p&gt;
&lt;p&gt;	}&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1650635" width="1" height="1"&gt;</description></item><item><title>re: Mapping from a type to an instance of that type</title><link>http://msmvps.com/blogs/jon_skeet/archive/2008/10/08/mapping-from-a-type-to-an-instance-of-that-type.aspx#1650632</link><pubDate>Sun, 12 Oct 2008 15:38:05 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1650632</guid><dc:creator>skeet</dc:creator><description>&lt;p&gt;Pavel: I can&amp;#39;t say I&amp;#39;ve used KeyedByTypeCollection before, but it looks like the values are all the same type (TItem) as opposed to the value for a particular key being an instance of that key (type).&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1650632" width="1" height="1"&gt;</description></item><item><title>re: Mapping from a type to an instance of that type</title><link>http://msmvps.com/blogs/jon_skeet/archive/2008/10/08/mapping-from-a-type-to-an-instance-of-that-type.aspx#1650631</link><pubDate>Sun, 12 Oct 2008 14:44:22 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1650631</guid><dc:creator>Pavel Minav</dc:creator><description>&lt;p&gt;Isn&amp;#39;t the stock KeyedByTypeCollection&amp;lt;T&amp;gt; class designed to solve precisely this problem?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1650631" width="1" height="1"&gt;</description></item><item><title>re: Formatting strings</title><link>http://msmvps.com/blogs/jon_skeet/archive/2008/10/06/formatting-strings.aspx#1650474</link><pubDate>Fri, 10 Oct 2008 14:35:21 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1650474</guid><dc:creator>Pavel Minaev</dc:creator><description>&lt;p&gt;Interestingly, that&amp;#39;s one case where F# ML curring functions allow for smoother syntax. You could curry Format with the format string, and if the implementation is smart, it will parse it at that point (or, alternatively, parse it first time it&amp;#39;s needed, but then memoize it). Then you save the function that is the result of that currying, and use it. I.e.:&lt;/p&gt;
&lt;p&gt;// Core functionality&lt;/p&gt;
&lt;p&gt;type ParsedFormatString = ...&lt;/p&gt;
&lt;p&gt;let ParseFormatString s = ...&lt;/p&gt;
&lt;p&gt;let FormatPreparsed parsedFormatString args = ...&lt;/p&gt;
&lt;p&gt;// BCL-style Format on top of that, with currying and memoization&lt;/p&gt;
&lt;p&gt;let Format formatString = FormatPreparsed (ParseFormatString formatString)&lt;/p&gt;
&lt;p&gt;...&lt;/p&gt;
&lt;p&gt;// Parse as usual&lt;/p&gt;
&lt;p&gt;for x = 1 to 10 do&lt;/p&gt;
&lt;p&gt; &amp;nbsp;for y = 1 to 10 do&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Format &amp;quot;{0} {1}&amp;quot; x y&lt;/p&gt;
&lt;p&gt;...&lt;/p&gt;
&lt;p&gt;// Memoize and reuse&lt;/p&gt;
&lt;p&gt;let FormatPair = Format &amp;quot;{0} {1}&amp;quot;&lt;/p&gt;
&lt;p&gt;for x = 1 to 10 do&lt;/p&gt;
&lt;p&gt; &amp;nbsp;for y = 1 to 10 do&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;FormatPair x y&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1650474" width="1" height="1"&gt;</description></item><item><title>Why should I use List&lt;T&gt; and not ArrayList</title><link>http://msmvps.com/blogs/jon_skeet/archive/2008/10/08/why-boxing-doesn-t-keep-me-awake-at-nights.aspx#1650445</link><pubDate>Fri, 10 Oct 2008 11:34:14 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1650445</guid><dc:creator>Helper Code</dc:creator><description>&lt;p&gt;I came upon a questing at StackOverflow : The system I work on here was written before .net 2.0 and didn&amp;#39;t&lt;/p&gt;
&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1650445" width="1" height="1"&gt;</description></item><item><title>re: Why boxing doesn't keep me awake at nights</title><link>http://msmvps.com/blogs/jon_skeet/archive/2008/10/08/why-boxing-doesn-t-keep-me-awake-at-nights.aspx#1650388</link><pubDate>Thu, 09 Oct 2008 22:20:16 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1650388</guid><dc:creator>skeet</dc:creator><description>&lt;p&gt;Ben: Absolutely. It should have been called &amp;quot;SINGLE_BOX&amp;quot; or something like that. I noticed it after I&amp;#39;d already done everything else, I&amp;#39;m afraid :(&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1650388" width="1" height="1"&gt;</description></item><item><title>re: Mapping from a type to an instance of that type</title><link>http://msmvps.com/blogs/jon_skeet/archive/2008/10/08/mapping-from-a-type-to-an-instance-of-that-type.aspx#1650387</link><pubDate>Thu, 09 Oct 2008 22:04:51 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1650387</guid><dc:creator>skeet</dc:creator><description>&lt;p&gt;Ben: That limits you to a single type/value mapping. DictionaryByType lets you have as many dictionaries as you want.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1650387" width="1" height="1"&gt;</description></item><item><title>re: Why boxing doesn't keep me awake at nights</title><link>http://msmvps.com/blogs/jon_skeet/archive/2008/10/08/why-boxing-doesn-t-keep-me-awake-at-nights.aspx#1650385</link><pubDate>Thu, 09 Oct 2008 21:59:23 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1650385</guid><dc:creator>Ben Voigt [C++ MVP]</dc:creator><description>&lt;p&gt;Ummm, I think the _NO_BOXING version is misnamed. &amp;nbsp;Surely this line:&lt;/p&gt;
&lt;p&gt;object o = i;&lt;/p&gt;
&lt;p&gt;involves boxing?&lt;/p&gt;
&lt;p&gt;Of course the new C++0x variable template typeargs will put an end to this discussion for a while (because all the ToString calls inside Format can be statically bound to the correct version in the C++0x version and even inlined). &amp;nbsp;This will give the first version the performance of the last one. &amp;nbsp;Well, maybe only the FORMAT_STRINGS version, still over 3x faster.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1650385" width="1" height="1"&gt;</description></item><item><title>re: Mapping from a type to an instance of that type</title><link>http://msmvps.com/blogs/jon_skeet/archive/2008/10/08/mapping-from-a-type-to-an-instance-of-that-type.aspx#1650382</link><pubDate>Thu, 09 Oct 2008 21:52:38 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1650382</guid><dc:creator>Ben Voigt [C++ MVP]</dc:creator><description>&lt;p&gt;Jon,&lt;/p&gt;
&lt;p&gt;What advantage does your method have over generic statics?&lt;/p&gt;
&lt;p&gt;public static class OneAndOnly&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp;private static class Content&amp;lt;T&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;static bool HasValue;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;static T Value;&lt;/p&gt;
&lt;p&gt; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp;public void Add&amp;lt;T&amp;gt;(T value)&lt;/p&gt;
&lt;p&gt; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;if (Content&amp;lt;T&amp;gt;.HasValue)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;throw new DuplicateKeyException();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Put(value);&lt;/p&gt;
&lt;p&gt; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp;public void Put&amp;lt;T&amp;gt;(T value)&lt;/p&gt;
&lt;p&gt; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Content&amp;lt;T&amp;gt;.Value = value;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Content&amp;lt;T&amp;gt;.HasValue = true;&lt;/p&gt;
&lt;p&gt; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp;public T Get&amp;lt;T&amp;gt;()&lt;/p&gt;
&lt;p&gt; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;if (Content&amp;lt;T&amp;gt;.HasValue)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;throw new KeyNotFoundException();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;return Content&amp;lt;T&amp;gt;.Value;&lt;/p&gt;
&lt;p&gt; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp;public bool TryGet&amp;lt;T&amp;gt;(out T value)&lt;/p&gt;
&lt;p&gt; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;value = Content&amp;lt;T&amp;gt;.Value;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;return Content&amp;lt;T&amp;gt;.HasValue;&lt;/p&gt;
&lt;p&gt; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp;public void Remove&amp;lt;T&amp;gt;()&lt;/p&gt;
&lt;p&gt; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Content&amp;lt;T&amp;gt;.HasValue = false;&lt;/p&gt;
&lt;p&gt; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1650382" width="1" height="1"&gt;</description></item><item><title>re: Mapping from a type to an instance of that type</title><link>http://msmvps.com/blogs/jon_skeet/archive/2008/10/08/mapping-from-a-type-to-an-instance-of-that-type.aspx#1650379</link><pubDate>Thu, 09 Oct 2008 21:48:59 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1650379</guid><dc:creator>SeeR</dc:creator><description>&lt;p&gt;That was me the guy who asked that question on stackoverflow an I think I found the solution.&lt;/p&gt;
&lt;p&gt;See my blog &lt;a rel="nofollow" target="_new" href="http://seermindflow.blogspot.com/2008/10/is-it-possible-to-write-c-application.html"&gt;seermindflow.blogspot.com/.../is-it-possible-to-write-c-application.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;or my answer on stackoverflow&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1650379" width="1" height="1"&gt;</description></item><item><title>re: Mapping from a type to an instance of that type</title><link>http://msmvps.com/blogs/jon_skeet/archive/2008/10/08/mapping-from-a-type-to-an-instance-of-that-type.aspx#1650352</link><pubDate>Thu, 09 Oct 2008 17:29:06 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1650352</guid><dc:creator>Todd</dc:creator><description>&lt;p&gt;With a traditional dictionary it seems much more clear who is the owner of the lifetime of the objects within the dictionary. In the case of a dictionary that contains the sole reference to IDisposables it is obvious that they all need to be disposed when the dictionary is no longer needed.&lt;/p&gt;
&lt;p&gt;It seems like with this dictionary the benefit partially lies in the ability of not knowing what people would put in it.&lt;/p&gt;
&lt;p&gt;The main reason why IDisposable came to mind was that the StackOverflow post adds a SqlConnection to the dictionary.&lt;/p&gt;
&lt;p&gt;Maybe my real concern is that this type of dictionary is not suitable for IDisposables at all, or at least not database connections. Maybe it would seem more correct if it was an object that created database connections.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1650352" width="1" height="1"&gt;</description></item><item><title>Qué es más rapido: String.Format o String.Concat?</title><link>http://msmvps.com/blogs/jon_skeet/archive/2008/10/06/formatting-strings.aspx#1650351</link><pubDate>Thu, 09 Oct 2008 17:28:29 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1650351</guid><dc:creator>.NET a 2.860 metros de altura</dc:creator><description>&lt;p&gt;Esta es una pregunta que he tenido pendiente mucho tiempo. En general yo prefiero usar String.Format&lt;/p&gt;
&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1650351" width="1" height="1"&gt;</description></item><item><title>re: Why boxing doesn't keep me awake at nights</title><link>http://msmvps.com/blogs/jon_skeet/archive/2008/10/08/why-boxing-doesn-t-keep-me-awake-at-nights.aspx#1650350</link><pubDate>Thu, 09 Oct 2008 17:25:37 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1650350</guid><dc:creator>Granville Barnett</dc:creator><description>&lt;p&gt;@David - I look at books as being a catalyst for further investigation. &lt;/p&gt;
&lt;p&gt;Maybe my approach is this because the books I tend to read are not as clear cut like most programming books are. This is just the way I feel about them in general.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1650350" width="1" height="1"&gt;</description></item><item><title>re: Mapping from a type to an instance of that type</title><link>http://msmvps.com/blogs/jon_skeet/archive/2008/10/08/mapping-from-a-type-to-an-instance-of-that-type.aspx#1650344</link><pubDate>Thu, 09 Oct 2008 16:28:43 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1650344</guid><dc:creator>skeet</dc:creator><description>&lt;p&gt;Todd: The dictionary shouldn&amp;#39;t care about any more than the .NET Dictionary class cares if you add references to IDisposable instances. It&amp;#39;s up to the client to clean up.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1650344" width="1" height="1"&gt;</description></item><item><title>re: Mapping from a type to an instance of that type</title><link>http://msmvps.com/blogs/jon_skeet/archive/2008/10/08/mapping-from-a-type-to-an-instance-of-that-type.aspx#1650340</link><pubDate>Thu, 09 Oct 2008 16:14:37 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1650340</guid><dc:creator>Todd</dc:creator><description>&lt;p&gt;What do you do when someone decides to store an IDisposable object in this dictionary? Should this dictionary be disposable and dispose of any disposable values when the time is appropriate?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1650340" width="1" height="1"&gt;</description></item><item><title>re: Formatting strings</title><link>http://msmvps.com/blogs/jon_skeet/archive/2008/10/06/formatting-strings.aspx#1650332</link><pubDate>Thu, 09 Oct 2008 15:15:08 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1650332</guid><dc:creator>skeet</dc:creator><description>&lt;p&gt;@Richard: I certainly wouldn&amp;#39;t suggest doing that. But I&amp;#39;d suggest doing:&lt;/p&gt;
&lt;p&gt;sb.Append(x);&lt;/p&gt;
&lt;p&gt;sb.Append(&amp;quot;:&amp;quot;);&lt;/p&gt;
&lt;p&gt;sb.Append(y);&lt;/p&gt;
&lt;p&gt;instead of&lt;/p&gt;
&lt;p&gt;sb.AppendFormat(&amp;quot;{0}:{1}&amp;quot;, x, y);&lt;/p&gt;
&lt;p&gt;(If performance were an issue, of course.)&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1650332" width="1" height="1"&gt;</description></item><item><title>re: Formatting strings</title><link>http://msmvps.com/blogs/jon_skeet/archive/2008/10/06/formatting-strings.aspx#1650331</link><pubDate>Thu, 09 Oct 2008 15:06:43 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1650331</guid><dc:creator>Richard</dc:creator><description>&lt;p&gt;As for the relative efficiency of String.Format versus StringBuilder.AppendFormat, have a look at the code for the String.Format(IFormatProvider, string, params object[]) method:&lt;/p&gt;
&lt;p&gt;public static string Format(...)&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;...&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;StringBuilder builder = new StringBuilder(format.Length + (args.Length * 8));&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;builder.AppendFormat(provider, format, args);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;return builder.ToString();&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;Clearly, if you already have a StringBuilder, it&amp;#39;s more efficient to call AppendFormat than Append(String.Format). &lt;/p&gt;
&lt;p&gt;The only caveat is if the format string is invalid: AppendFormat will append the start of the format string, and then throw an exception, whereas Append(String.Format) will throw an exception without modifying the StringBuilder instance.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1650331" width="1" height="1"&gt;</description></item><item><title>re: Why boxing doesn't keep me awake at nights</title><link>http://msmvps.com/blogs/jon_skeet/archive/2008/10/08/why-boxing-doesn-t-keep-me-awake-at-nights.aspx#1650324</link><pubDate>Thu, 09 Oct 2008 14:42:10 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1650324</guid><dc:creator>David Nelson</dc:creator><description>&lt;p&gt;@Chris, Granville&lt;/p&gt;
&lt;p&gt;Of course you cannot take everything you read in a book as 100% gospel; even good authors sometimes make mistakes and are sometimes just plain wrong.&lt;/p&gt;
&lt;p&gt;But at the same time, part of the reason that developers read books is that there is way more out there to learn than they could ever possibly learn on their own through experimentation. The software world is expanding far too quickly, no more so than in the .NET space. So developers read books by people who are supposedly already experienced in a particular topic as an efficient way of assimilating new information. If the author is wrong, or is exaggerating, then the reader is assimilating WRONG information, which undermines the point of reading the book in the first place. Sure, the reader could go out and verify everything he reads for himself, but then what is the point of reading the book?&lt;/p&gt;
&lt;p&gt;That is why it is so important for authors to make every effort to be as accurate as possible; like it or not, what they say is often the first and possibly the last impression that a developer will get on a particular subject, and if they care at all about being positive contributors to the development community, they need to do their best to make sure that impression is the right one.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1650324" width="1" height="1"&gt;</description></item><item><title>re: Why boxing doesn't keep me awake at nights</title><link>http://msmvps.com/blogs/jon_skeet/archive/2008/10/08/why-boxing-doesn-t-keep-me-awake-at-nights.aspx#1650319</link><pubDate>Thu, 09 Oct 2008 13:24:03 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1650319</guid><dc:creator>skeet</dc:creator><description>&lt;p&gt;Yup, that&amp;#39;s the book I&amp;#39;ll be getting when it&amp;#39;s available in the US. I think they&amp;#39;ve changed the title though - it used to include the word &amp;quot;Annotated&amp;quot; right there.&lt;/p&gt;
&lt;p&gt;I already have the 2.0 edition, signed by Anders, Scott and Peter :)&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1650319" width="1" height="1"&gt;</description></item></channel></rss>