我在C#中编写了一些代码,我发现自己写了:
return new MyClass(...
当我注意到,这两个return
和new
都是C#关键字.所以我想知道C#中最长的关键字合法序列是什么.我能想到的只有:
internal static override void MyFunc(...
internal static override void
所有关键字在哪里?你能想到更长的关键词序列吗?
注意:这个问题确实没有意义.我只是希望在火上浇一些乐趣:-)
对于6:
new protected internal unsafe virtual decimal Foo() {...}
编辑7:
new protected internal unsafe virtual extern decimal Foo();
如果我们允许括号和括号......
(编辑 "锁定","新对象()","as"和"字符串"由其他人提供;见评论)
decimal Bar() { lock (new object() as string) { if (true) { checked { unsafe { try { do { return default(decimal); unchecked {break;} continue; } while (false); } catch { throw; } finally { } } } } } }
我想这是无限的:
return null as string as string as string as string as string....