Why do we have to name interface method parameters?

后端 未结 5 1498
醉酒成梦
醉酒成梦 2021-01-03 21:52

In C# we have to name the parameters of a method of an interface.

I understand that even if we didn\'t have to, doing so would help a reader understand the meaning,

5条回答
  •  情话喂你
    2021-01-03 22:56

    Naming interface method parametres helps with self documentation:

    For example ...

    interface IRenderable
    {
        void Render(TimeSpan gameTime);
    }
    

    ... says more than:

    interface IRenderable
    {
        void Render(TimeSpan);
    }
    

提交回复
热议问题