Tips for writing fluent interfaces in C# 3

前端 未结 8 1706
借酒劲吻你
借酒劲吻你 2020-12-07 11:39

I\'m after some good tips for fluent interfaces in C#. I\'m just learning about it myself but keen to hear what others think outside of the articles I am reading. In particu

8条回答
  •  自闭症患者
    2020-12-07 11:50

    One thing is that you have to account for the morphology of English syntax and ensure that you have not introduced undocumented sequential coupling underneath.

    // Snarky employees get a raise.
    employees.WhereSnarky().GiveRaise();
    

    vs.

    // Depending on implementation, everyone may get a raise.
    employees.GiveRaise().WhereSnarky();
    

提交回复
热议问题