help.net
<font size="2"><br />Musing on .Net</font>
-
Generics as Type Constructors
From Don Box:The CLR began its life with three fixed type constructors:- Array (T[])
- Managed Pointer (T&)
- Unmanaged Pointer (T*)
Each of these type constructors acts as an operator on another type and allows you to construct new types without an explicit definition.For example, given this type:public struct Person { public string SSN; public double Age; }I can now ask the CLR to create new types by applying one or more type constructors:Console.WriteLine(Type.GetType("Person[]"));Console.WriteLine(Type.GetType("Person*"));Console.WriteLine(Type.GetType("Person&"));Console.WriteLine(Type.GetType("Person[][]"));Console.WriteLine(Type.GetType("Person[][]&"));Console.WriteLine(Type.GetType("Person[][][][]&"));The six types that are loaded by these statements have no a priori definition - rather, they are synthesized out of thin air by applying one or more operators to a "real" type.Generics in the CLR allow anyone to write a type constructor. For example, consider this generic type:public struct Named<T> {public T Value;pubic string Name;}Given this new "operator", I can do the following (note that GetType uses [] not <> for parameters):Console.WriteLine(Type.GetType("Named[Person]"));Console.WriteLine(Type.GetType("Named[Person][]"));Console.WriteLine(Type.GetType("Named[Person[]]"));Console.WriteLine(Type.GetType("Named[Named[Person]]"));Console.WriteLine(Type.GetType("Named[Named[Named[Person]]]"));which is roughly equivalent to this more direct version:Console.WriteLine(typeof(Named<Person>));Console.WriteLine(typeof(Named<Person>[]));Console.WriteLine(typeof(Named<Person[]>));Console.WriteLine(typeof(Named<Named<Person>>));Console.WriteLine(typeof(Named<Named<Named<Person>>>));As this example shows, Named<T> is yet another operator I can compose with other operators (both the built-in and user-defined type operators).This compositional style of taking two or more abstractions that know nothing about one another and combining them to get higher-order functionality has really changed the way I look at designing object models. -
INETA potential: not for Craggy Island
Julia mentioned something today about INETA that caught my attention
-
Microsoft bloggers on the grill
Interesting thoughts from John Udell about the fact that you can find more interesting posts in the blogs than in MSDN .Reading this make me think that some growing conflicts are raising slowly in Microsoft. I hope it will not be the start of the end for some very good MS bloggers.
-
Convert code to HTML
I found some good code from DotNetJunkie XL on the 7th Floor.
-
Convert Code To HTML
UPDATE: Refer to my latest article you can read here:
-
"Access denied" Error Message When You Run an ASP.NET 1.0 Application in IIS 6.0
Full Knowledge Base (KB) Article: http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q817033
-
Verbatim Identifier
Mark Michaelis posts about Using @ to Disambiguate Keywords from Identifiers in C#. So, if you want to call a class “class”, you could do it like this:
-
Maintain Scroll Position in any Page Element
Good tip from Jim Ross on ASP Alliance.
Only for IE.
Other methods exist but this one is nice. -
Common functions and inheritance
I received some interesting comments on one of my recent posts.
What do you think about these ideas ? -
Common functions
Pete submit an interesting question on the mail list