. Topicala Page Index Token

A Journal about the experiences I have developing little applications in C#, Perl, Html and Javascript and talking about things new things that I use. Always Geeky; Always Nerdy; Always poor Grammer!

I am a Software Analyst Developer working in Southport, England but living in Liverpool. I develop mainly in C# and ASP.Net. I have been developing comercial software for several years now. I maintain this site (hosted at SwitchMedia UK) as a way of exploring new technologies (such as AJAX) and just generally talking about techie geek issues. This site is developed through a host of Perl scripts and a liberal use of Javascript. I enjoy experimenting with new technologies and anything that I make I host here.

Quick Search

Web www.kinlan.co.uk

Sunday, July 24, 2005

c# generics 3.0

I was just reading MattWar's web log (The Wayward Weblog) about in C#3.0. The article mentions that furure generics might be also tied to XML Types.

I am not too sure I understand the concept. Well not at least the way it was described. To Quote:

"On the surface, the two might seem to have nothing to do with each other, but if you dig deeper you soon realize that the two are fundamentally linked, the two concepts not separate but actually compliments of one
another."

The log goes futher, it describes how they are conceptually linked together. However, from what I have read, it is only the fact that a generic and an XML enclosure is syntatically similar by the use of angled brackets.

Currently as I understand it generics, allow the use of parameterised specialisation of a class without having to re-write the class to handle different types of objects. For instance a list collection can be "bound" to an int, long, Cars, EarMuffs etc, and the type checking of the compiler will ensure that all uses are syntacitcally and sematically correct.

The example of an is Foo<int x ="..."/>, unfortuatly I don't really understand what is happenging there.
  • Is the Foo parametised to an integer with a default value of "x";
  • Is it a "Foo" element just simply with an attribute on;
  • Is the "Foo" element constrained futher by the attributes on the XML element (see below);
  • Is it that the Foo element is converted to a class and then parameterised with member variables, which are really XML attributes.

I just simply don't understand the point of (using the blogs example). Why not generate your class from an XSD and paramaterise the type to the XSD'ed class.

Will future XML Generics be tied to a schema, so that parameters can be constrained via certain values (which I can see the point of, Foo<int type="xsd:positiveInteger" restriction="minValue"/> which would might constrain the Foo object to types on integers with a minValue) .

I am really looking forward to futher information on this. Because I am sure it is correct that it is a shift and a major question to re-work my current understanding.

Comments: [Add New]