<?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>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</link><description>A question came up on Stack Overflow yesterday which I&amp;#39;ve had to deal with myself before now. There are times when it&amp;#39;s helpful to have one value per type, and that value should be an instance of that type. To express it in pseudo-code, you want</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP2 (Build: 40407.4157)</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: 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: 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>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: 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#1650298</link><pubDate>Thu, 09 Oct 2008 12:26:25 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1650298</guid><dc:creator>skeet</dc:creator><description>&lt;p&gt;@Clippy: That&amp;#39;s certainly one use for it (and the one in the SO question). As it happens, my use was somewhat different, and not service based :)&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1650298" width="1" height="1"&gt;</description></item><item><title>Clippy Appears!</title><link>http://msmvps.com/blogs/jon_skeet/archive/2008/10/08/mapping-from-a-type-to-an-instance-of-that-type.aspx#1650292</link><pubDate>Thu, 09 Oct 2008 11:54:47 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1650292</guid><dc:creator>clippy</dc:creator><description>&lt;p&gt;&amp;quot;Hi, It looks like you&amp;#39;re writing an IOC container!&lt;/p&gt;
&lt;p&gt;For service locator functions it might be useful to take a look at using the CommonServiceLocator interface &lt;a rel="nofollow" target="_new" href="http://www.codeplex.com/CommonServiceLocator"&gt;www.codeplex.com/CommonServiceLocator&lt;/a&gt;. Not only is this nice and clear, but also will minimise friction if you decide to use an existing IOC container later.&amp;quot;&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1650292" 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#1650290</link><pubDate>Thu, 09 Oct 2008 11:25:39 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1650290</guid><dc:creator>James Hart</dc:creator><description>&lt;p&gt;Agreed, it&amp;#39;s a lot of effort to go to just to avoid a cast - though the possibility of avoiding boxing primitives in the dictionary might be a more tempting reason to use it, the weak key cleanup would probably introduce a horrendous overhead in any implementation that was using enough instances of this type to benefit from the savings due to boxing :)&lt;/p&gt;
&lt;p&gt;That approach is actually derived from one that came up when trying to come up with a state mechanism for extension methods, where the idea of a weak dictionary makes more sense. &lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1650290" 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#1650279</link><pubDate>Thu, 09 Oct 2008 09:55:38 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1650279</guid><dc:creator>skeet</dc:creator><description>&lt;p&gt;Ooh, interesting. I&amp;#39;d thought of the use of generic statics, but run into the &amp;quot;values per dictionary&amp;quot; issue - which you&amp;#39;ve neatly sidestepped.&lt;/p&gt;
&lt;p&gt;I think I probably prefer the cast to using weak references, but that&amp;#39;s a really interesting approach :)&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1650279" 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#1650276</link><pubDate>Thu, 09 Oct 2008 09:37:11 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1650276</guid><dc:creator>James Hart</dc:creator><description>&lt;p&gt;If you have a weak dictionary implementation (one that uses weak-reference keys and cleans out otherwise unreferenced keys and their associated values), you could try something like this to avoid casts:&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;public class TypeDictionary&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;private class InnerTypeDictionary&amp;lt;T&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;static WeakDictionary&amp;lt;TypeDictionary, T&amp;gt; _innerDictionary = new WeakDictionary&amp;lt;TypeDictionary, T&amp;gt;();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;public static void Add(TypeDictionary dic, T value)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;_innerDictionary.Add(dic, value);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;public static T GetValue(TypeDictionary dic)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return _innerDictionary[dic];&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;public void Add&amp;lt;T&amp;gt;(T value)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;InnerTypeDictionary&amp;lt;T&amp;gt;.Add(this, value);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;public T GetValue&amp;lt;T&amp;gt;()&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return InnerTypeDictionary&amp;lt;T&amp;gt;.GetValue(this);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;} &lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1650276" width="1" height="1"&gt;</description></item><item><title>Reflective Perspective - Chris Alcock  &amp;raquo; The Morning Brew #197</title><link>http://msmvps.com/blogs/jon_skeet/archive/2008/10/08/mapping-from-a-type-to-an-instance-of-that-type.aspx#1650264</link><pubDate>Thu, 09 Oct 2008 07:20:05 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1650264</guid><dc:creator>Reflective Perspective - Chris Alcock  » The Morning Brew #197</dc:creator><description>&lt;p&gt;Pingback from &amp;nbsp;Reflective Perspective - Chris Alcock &amp;nbsp;&amp;raquo; The Morning Brew #197&lt;/p&gt;
&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1650264" 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#1650199</link><pubDate>Wed, 08 Oct 2008 20:59:56 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1650199</guid><dc:creator>Jesper</dc:creator><description>&lt;p&gt;I&amp;#39;d expect the Dictionary type to track the generic IDictionary interface fairly closely. Fair enough, I suppose, since other interfaces and classes don&amp;#39;t necessarily.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1650199" 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#1650196</link><pubDate>Wed, 08 Oct 2008 20:48:18 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1650196</guid><dc:creator>skeet</dc:creator><description>&lt;p&gt;@Jesper: Just general principle. I tend to like to use interfaces where I can. It (hopefully) makes it clear to anyone reading the code that I&amp;#39;m not relying on any particular extras supplied by Dictionary.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1650196" 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#1650193</link><pubDate>Wed, 08 Oct 2008 20:42:44 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1650193</guid><dc:creator>Jesper</dc:creator><description>&lt;p&gt;Is there a particular reason why you typed a private readonly object that&amp;#39;s only ever a Dictionary as the interface it implements?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1650193" width="1" height="1"&gt;</description></item></channel></rss>