I was writing some return type from function when I got brilliant dumb idea to start playing with braces, question marks etc.
And I came with some self-competition to write a lot of different characters into a valid type definition (in C#, of course). And simple repeating doesn’t count. But why not to create this as a public competition.
With the short first try I ended up with this:
IEnumerable<KeyValuePair<int, int?>?[,]>
That’s probably not the best what can be done. Do you have better idea? OK, it’s your turn. Use comments. The best – I’m the referee – will get the lolipop.
Sorry for all spanish speaking people if the word in title isn’t right.




#1 by Tomas Petricek on 11.5.2009 - 00:39
Quote
Hi, here is my type. Without namespaces, it looks like this:Func>,Expression>,Expression >>It’s not something I made up right now. I’ve been actually using this here: http://tomasp.net/blog/dynamic-linq-queries.aspx However, you get some bonus points for using funky symbols like “?”, “[,]“.Did I win some prize
? T.
#2 by cincura.net on 11.5.2009 - 09:12
Quote
Hi Tomas,nice, but I’m afraid, this is simple repeating. :\ But you’re right now on 2nd place and that’s half of lolipop.
Let’s see what will others create.
#3 by rob on 11.5.2009 - 11:35
Quote
You write about C# obsession and you forget to use this most significant character
) IEnumerable?[,]>#if DEBUG []#endif myMember;
#4 by cincura.net on 11.5.2009 - 11:42
Quote
What character do you mean? The ‘#’? I have doubts it’s allowed in type definiton.
#5 by rob on 11.5.2009 - 11:55
Quote
# of course. Just try what I created… It works fine. I wouldn’t suggest anyone to use such things, but the same is true for your type definition, isn’t it?
#6 by cincura.net on 11.5.2009 - 12:34
Quote
Yes. But the ‘#’ isn’t valid for type (at least I think). I’m interested only in pure type definition characters.
#7 by rob on 11.5.2009 - 13:14
Quote
Using #if in type definition is definitely valid.The rest is question of interpretation. If you look on given compilation result then type definition is unconditional (it doesn’t contains #). But if you look on C# source then definition of type is conditional and contains # character.According to rules you presented in this blog I assume that source definition is important.
#8 by cincura.net on 11.5.2009 - 13:23
Quote
The #if isn’t defining the type nor it’s part of type. It’s conditional directive, for compiler. It’s valid code, but not type (only type).
<joking>And I’ll be choosing the winner, hence I say no.
</joking>
#9 by rob on 11.5.2009 - 17:04
Quote
I don’t agree
But it’s certainly wise choice from you, because at the moment you allow it, someone can suggest someting like#if (DEBUG && !VC_V7)So what about this:IEnumerable<KeyValuePair<global::System.Int32, int?>?[,]>There is . and :
#10 by cincura.net on 11.5.2009 - 17:12
Quote
Yep, somebody can suggest this, but for me it’s not a type definition (in my definition).
The ‘:’ and ‘.’ it’s good, extra points added.
#11 by pbouda on 11.5.2009 - 17:41
Quote
One extra character:
@IEnumerable<KeyValuePair<global::System.Int32, int?>?[,]>
#12 by cincura.net on 11.5.2009 - 21:49
Quote
Nice. I didn’t even know that the ‘@’ is working here.
#13 by cincura.net on 26.6.2009 - 19:09
Quote
There were good improvements to my base, but only one can be winner – the idea with “@” from pbouda. I’ll try to contact you via email and find some way to give you the prize (lolipop or beer).