<?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>What is this thing you call a "type"? Part Two</title><link>http://blogs.msdn.com/b/ericlippert/archive/2011/09/07/what-is-this-thing-you-call-a-quot-type-quot-part-two.aspx</link><description>Well that was entirely predictable; as I said last time , if you ask ten developers for a definition of "type", you get ten different answers. The comments to the previous article make for fascinating reading! 
 Here's my attempt at describing what </description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: What is this thing you call a "type"? Part Two</title><link>http://blogs.msdn.com/b/ericlippert/archive/2011/09/07/what-is-this-thing-you-call-a-quot-type-quot-part-two.aspx#10238960</link><pubDate>Sun, 20 Nov 2011 21:46:14 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10238960</guid><dc:creator>Vlad</dc:creator><description>&lt;p&gt;@Eric: I&amp;#39;ve just asked a question on SO about the type of null literal, which seems to be quite close to the topic of this discussion -- maybe you could comment there? &lt;a rel="nofollow" target="_new" href="http://stackoverflow.com/questions/8204578/what-is-the-type-of-null-literal"&gt;stackoverflow.com/.../what-is-the-type-of-null-literal&lt;/a&gt;&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10238960" width="1" height="1"&gt;</description></item><item><title>re: What is this thing you call a "type"? Part Two</title><link>http://blogs.msdn.com/b/ericlippert/archive/2011/09/07/what-is-this-thing-you-call-a-quot-type-quot-part-two.aspx#10215502</link><pubDate>Thu, 22 Sep 2011 20:04:14 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10215502</guid><dc:creator>Michael</dc:creator><description>&lt;p&gt;I always used the following to define &amp;quot;type&amp;quot; in a programming context:&lt;/p&gt;
&lt;p&gt;A type is a schema and associated set of rules for interpreting the meaning behind the bits of a segment of memory.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10215502" width="1" height="1"&gt;</description></item><item><title>re: What is this thing you call a "type"? Part Two</title><link>http://blogs.msdn.com/b/ericlippert/archive/2011/09/07/what-is-this-thing-you-call-a-quot-type-quot-part-two.aspx#10211938</link><pubDate>Thu, 15 Sep 2011 19:33:16 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10211938</guid><dc:creator>CarlD</dc:creator><description>&lt;p&gt;@Marvin - That link is for WinRT which is a new runtime. &amp;nbsp;It&amp;#39;s not .NET 4.5.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10211938" width="1" height="1"&gt;</description></item><item><title>re: What is this thing you call a "type"? Part Two</title><link>http://blogs.msdn.com/b/ericlippert/archive/2011/09/07/what-is-this-thing-you-call-a-quot-type-quot-part-two.aspx#10211316</link><pubDate>Wed, 14 Sep 2011 23:57:53 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10211316</guid><dc:creator>Marvin</dc:creator><description>&lt;p&gt;I was looking at the notes for .Net 4.5 posted here: &lt;a href="http://msdn.microsoft.com/en-us/library/windows/apps/br230302%28v=VS.85%29.aspx" rel="nofollow" target="_new"&gt;msdn.microsoft.com/.../br230302%28v=VS.85%29.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I think I see massive breaking changes to System.Type. &amp;nbsp;Is this line of posts somehow leading up to a discussion of those changes?&lt;/p&gt;
&lt;div class="yellowbox"&gt;
&lt;p&gt;It is not. -- Eric&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10211316" width="1" height="1"&gt;</description></item><item><title>re: What is this thing you call a "type"? Part Two</title><link>http://blogs.msdn.com/b/ericlippert/archive/2011/09/07/what-is-this-thing-you-call-a-quot-type-quot-part-two.aspx#10210266</link><pubDate>Tue, 13 Sep 2011 21:45:51 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10210266</guid><dc:creator>Stuart</dc:creator><description>&lt;p&gt;... tested those things. Apparently you can&amp;#39;t - the &amp;quot;var&amp;quot; and the method call, respectively, are illegal. It&amp;#39;s weird that default(Enumerable) is permitted and you can compare it against null, for example, but you can&amp;#39;t store that value in a variable.&lt;/p&gt;
&lt;p&gt;@DRBlaise - I don&amp;#39;t think that anything that uses reflection is a valid counterpoint. The C# language spec defines what can be expressed in C#, not what the runtime and base class library support. So I dispute that your 1 and 2 are violations of the language spec (although it might still be a good idea if the runtime disallowed them). I agree that your 3, 4 and 5 seem like compiler bugs.&lt;/p&gt;
&lt;div class="yellowbox"&gt;
&lt;p&gt;It is weird that you can get the default value of a static class! I&amp;#39;ll mention that to Mads; it seems like an oversight that it was not made illegal. Thanks! -- Eric&lt;/p&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10210266" width="1" height="1"&gt;</description></item><item><title>re: What is this thing you call a "type"? Part Two</title><link>http://blogs.msdn.com/b/ericlippert/archive/2011/09/07/what-is-this-thing-you-call-a-quot-type-quot-part-two.aspx#10210261</link><pubDate>Tue, 13 Sep 2011 21:39:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10210261</guid><dc:creator>Stuart</dc:creator><description>&lt;p&gt;So can you do &amp;quot;var x &amp;nbsp;= default(Enumerable)&amp;quot; and get a declared variable of that type?&lt;/p&gt;
&lt;p&gt;Or perhaps create a method void Foo&amp;lt;T&amp;gt;(T t) {...} and then call it with default(Enumerable) in order to bind Enumerable to a generic type parameter?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10210261" width="1" height="1"&gt;</description></item><item><title>re: What is this thing you call a "type"? Part Two</title><link>http://blogs.msdn.com/b/ericlippert/archive/2011/09/07/what-is-this-thing-you-call-a-quot-type-quot-part-two.aspx#10209892</link><pubDate>Tue, 13 Sep 2011 13:51:56 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10209892</guid><dc:creator>DRBlaise</dc:creator><description>&lt;p&gt;configurator: I did some more investigation that led me to the conclusion that a &amp;quot;static class&amp;quot; is just a regular type that is both abstract and sealed. &amp;nbsp;It&amp;#39;s base class is object, but it has no instance constructors. &amp;nbsp;The 4.0 C# Spec section 10.1.1.3.1 does not match compiler behavior on several points: &amp;quot;.., it is an error for a static class to be used as a base class, a constituent type (§10.3.8) of a member, a generic type argument, or a type parameter constraint. Likewise, a static class cannot be used in an array type, a pointer type, a new expression, a cast expression, an is expression, an as expression, a sizeof expression, or a default value expression.&amp;quot;&lt;/p&gt;
&lt;p&gt;1. &amp;quot;generic type argument&amp;quot; - you can use reflection to create a valid generic type with a &amp;quot;static class&amp;quot; as the generic type.&lt;/p&gt;
&lt;p&gt;2. &amp;quot;an array type&amp;quot; - you can use Array.CreateInstance or reflection to create a &amp;quot;static class&amp;quot; array and use SetValue and GetValue to reference the values in the Array which will always be null.&lt;/p&gt;
&lt;p&gt;3. &amp;quot;is expression&amp;quot; - (x is Enumerable) is valid, but warns it is always false.&lt;/p&gt;
&lt;p&gt;4. &amp;quot;as expression&amp;quot; - (x as Enumerable) is valid, but will always be null.&lt;/p&gt;
&lt;p&gt;5. &amp;quot;default value expression&amp;quot; - default(Enumerable) is valid and will be null.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10209892" width="1" height="1"&gt;</description></item><item><title>re: What is this thing you call a "type"? Part Two</title><link>http://blogs.msdn.com/b/ericlippert/archive/2011/09/07/what-is-this-thing-you-call-a-quot-type-quot-part-two.aspx#10209857</link><pubDate>Tue, 13 Sep 2011 12:29:44 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10209857</guid><dc:creator>configurator</dc:creator><description>&lt;p&gt;DRBlaise: A static class is not a type. It&amp;#39;s got a Type (which is why you can use typeof), but it&amp;#39;s not a type (meaning you can&amp;#39;t use it to describe a storage location).&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10209857" width="1" height="1"&gt;</description></item><item><title>re: What is this thing you call a "type"? Part Two</title><link>http://blogs.msdn.com/b/ericlippert/archive/2011/09/07/what-is-this-thing-you-call-a-quot-type-quot-part-two.aspx#10209431</link><pubDate>Mon, 12 Sep 2011 13:36:25 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10209431</guid><dc:creator>DRBlaise</dc:creator><description>&lt;p&gt;I believe I found an exception to the 3rd type rule: If T is a type and n is a positive integer then &amp;quot;n-dimensional array of T&amp;quot; is also a type. &amp;nbsp;A &amp;quot;static class&amp;quot; type can&amp;#39;t be used as an array type. &amp;nbsp;I was wondering if your definition of type is excluding &amp;quot;static class&amp;quot;? &amp;nbsp;&lt;/p&gt;
&lt;p&gt;The C# Specification has the ambiguous statement: &amp;quot;A static class cannot be instantiated, cannot be used as a type and can contain only static members.&amp;quot; &amp;nbsp;And yet a static class can be used in &amp;quot;typeof&amp;quot; and even &amp;quot;default&amp;quot;. &amp;nbsp;So is a &amp;quot;static class&amp;quot; a type or not?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10209431" width="1" height="1"&gt;</description></item><item><title>re: What is this thing you call a "type"? Part Two</title><link>http://blogs.msdn.com/b/ericlippert/archive/2011/09/07/what-is-this-thing-you-call-a-quot-type-quot-part-two.aspx#10209191</link><pubDate>Sun, 11 Sep 2011 21:37:34 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10209191</guid><dc:creator>configurator</dc:creator><description>&lt;p&gt;Do you have a link or reference to something which discusses such topologies? I find that really interesting and it&amp;#39;s possibly quite useful as well!&lt;/p&gt;
&lt;p&gt;Would an interface such as public interface IC&amp;lt;X&amp;gt; : IN&amp;lt;IN&amp;lt;IC&amp;lt;IC&amp;lt;X&amp;gt;&amp;gt;&amp;gt;&amp;gt; {} not be allowed in that case?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10209191" width="1" height="1"&gt;</description></item></channel></rss>