我还支持使用 _ => _.method()来实现单行的方法调用 lambdas,因为它降低了指令的认知重量。特别是在使用泛型时,编写 x => x.method()只是增加了“这个‘ x’是什么?它是一个空间坐标吗?”.
考虑以下情况:
Initialize<Client> ( _=>_.Init() );
Used with a Generics call, the underscore in this case works as a "bypass symbol". It avoids redundancy, defining that the type of the argument is obvious and can be infered from usage - just as when you use 'var' to prevent repeating a type declaration. Writing client=>client.Init() here would just make the instruction longer without adding any meaning to it.