相关疑难解决方法(0)

私有方法命名约定

是否存在命名我称之为" _Add" 的私有方法的约定?我不是领先下划线的粉丝,但这是我的一个队友建议的.

public Vector Add(Vector vector) {
    // check vector for null, and compare Length to vector.Length
    return _Add(vector);
}

public static Vector Add(Vector vector1, Vector vector2) {
    // check parameters for null, and compare Lengths
    Vector returnVector = vector1.Clone()
    return returnVector._Add(vector2);
}

private Vector _Add(Vector vector) {
    for (int index = 0; index < Length; index++) {
        this[index] += vector[index];
    }
    return this;
}
Run Code Online (Sandbox Code Playgroud)

c# coding-style private-methods

36
推荐指数
6
解决办法
3万
查看次数

标签 统计

c# ×1

coding-style ×1

private-methods ×1