Issue
I was writing some code in C#, and I found myself writing:
return new MyClass(...
when I noticed that both the return
and the new
were both C# keywords. So I wondered what is the longest legal sequence of keywords in C#. All I could think of is:
internal static override void MyFunc(...
Where internal static override void
are all keywords. Can you think of a longer sequence of keywords?
Note: There's really no point to the question. I'm just hoping to pour more some fun on the fire :-)
Solution
For 6:
new protected internal unsafe virtual decimal Foo() {...}
Edit for 7:
new protected internal unsafe virtual extern decimal Foo();
If we allow brackets and braces...
(edited the "lock", "new object()", "as" and "string" were contributed by others; see comments)
decimal Bar() {
lock (new object() as string) {
if (true) {
checked {
unsafe {
try {
do {
return default(decimal);
unchecked {break;}
continue;
} while (false);
}
catch { throw; }
finally { }
}
}
}
}
}
Answered By - Marc Gravell Answer Checked By - Clifford M. (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.