Class inheritance naming

2019-07-07 05:52发布

I want to inherit the DevExpress ComboBoxEdit control, and am wondering if naming my class the same as the DevExpress class is bad practice.

Here's the derived class declaration:

using System;
using System.Collections.Generic;
using System.Text;

namespace MyApplication.Components
{
    public class ComboBoxEdit : DevExpress.XtraEditors.ComboBoxEdit
    {
    }
}

Should I rename MyApplication.Components.ComboBoxEdit to something else like MyComboBoxEdit?

8条回答
霸刀☆藐视天下
2楼-- · 2019-07-07 06:31

I too would advise against a naming collision. With respect to the name, if you have a reason to create an inherited control, then you should be able to give a useful name.

The My prefix is severely limiting and has little value to newcomers reading the code. You also risk running into MyComboBox2 when you need a new one.

查看更多
在下西门庆
3楼-- · 2019-07-07 06:33

Well, it's legal to do it, but I would advise against it because it would only cause confusion... Why not name it "MyComboBoxEdit" or "SuperComboBoxEdit" or anything you like ?

查看更多
登录 后发表回答