What is the longest legal statement block you can make with only C# keywords?

后端 未结 8 1385
粉色の甜心
粉色の甜心 2020-12-28 16:39

I was writing some code in C#, and I found myself writing:

return new MyClass(...

when I noticed that both the return and the

相关标签:
8条回答
  • 2020-12-28 17:37

    10 with extern partial hacks

    abstract partial class A
    {
        private protected virtual extern unsafe ref readonly delegate*<int> Test();
    }
    
    partial class B : A
    {
        private protected sealed override unsafe partial ref readonly delegate*<int> Test();
    
        // 1        2       3       4       5      6       7     8     9        10
        private protected sealed override extern unsafe partial ref readonly delegate*<int> Test();
    }
    
    0 讨论(0)
  • 2020-12-28 17:39
    public abstract class Base {
        protected internal abstract ref readonly int MyMethod();
    }
    
    public class Sub : Base {
        extern sealed protected internal override unsafe ref readonly int MyMethod();
    }
    

    Managed to get 9 into a method declaration. Not sure if it's possible to get more in a method declaration

    0 讨论(0)
提交回复
热议问题