c# - 具有相同名称的非通用类和通用类的不良做法?

标签 c# class language-agnostic naming-conventions

令我惊讶的是我能够做到这一点:

public abstract class BaseComponent
{
    protected GameObject GameObject;

    internal BaseComponent(GameObject gameObject)
    {
        GameObject = gameObject;
    }
}

public abstract class BaseComponent<TComponent, TManager> : BaseComponent
where ...
{

}
  1. 为我的 2 个类(class)命名是否是相同的错误做法?
  2. 在这种情况下是否有标准的命名约定?

最佳答案

Is naming my 2 classes the same bad practice?

没有。

Is there a standard naming convention in this case?

同名即可。比照。 IEnumerableIEnumerable<T> .

To my surprise i'm able to do this:

为什么是惊喜?它很直观,并且是框架中的标准。

关于c# - 具有相同名称的非通用类和通用类的不良做法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8139563/

相关文章:

java - Java嵌套静态类

security - 变量隐私实际上与安全性有什么关系,还是只是为了编程方便?

database - 将数据行移动到另一个分片的最佳方法?

c# - 从爱尔兰的服务器获取丹麦的本地日期时间

c# - 扩展方法对子类不起作用?

c++ - 初始化类对象数组

language-agnostic - 按位检查标志是否存在

c# - 如何让子类属性不是 super 和 sub 在一起

c# - 控件的名称不存在,即使它存在

php - 简化的递归 PHP