0

考虑这些接口:

interface IBar
{
    void bar();
}

interface IFoo : IBar
{
    void foo();
}

#region使用块对代码进行分组是很常见的。在实现的具体类IFoo中,我可以想到两个有意义的区域配置。

我的问题是;哪个是首选约定?请激发你的回答。

A:

class Foo : IFoo
{
    #region IFoo interface
    void foo() {}
    void bar() {}
    #endregion
}

乙:

class Foo : IFoo
{
    #region IFoo interface
    void foo() {}
    #endregion

    #region IBar interface
    void bar() {}
    #endregion
}
4

2 回答 2

3

如果区域划分不同的逻辑区域,则首选 B(这是我个人的偏好)。

于 2013-05-28T07:11:50.350 回答
1

让团队中的所有开发人员投票选出最易读的风格,然后坚持下去。

于 2013-05-28T07:11:29.217 回答