关于使用My作为类名前缀的意见 [英] Opinions on using My as a class name prefix

查看:201
本文介绍了关于使用My作为类名前缀的意见的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

个人而言,我从不喜欢类的 MyObject 命名.我猜想现状会同意,但是我想看看论点的另一面,以及它是否有任何合法性.

Personally, I've never liked the MyObject naming of classes. I would guess that the status quo would agree but I'd like to see the other side of the argument and if there's any validity to it.

推荐答案

尽管我敢说它存在,但我从未在生产代码中看到它完成.

I've never seen it done in production code, although I dare say it exists.

这就像元语法变量"foo"和"bar"一样-通常用作实名的占位符.

It's like the metasyntactic variables "foo" and "bar" - it's usually used as a placeholder for a real name.

因此,例如,如果我知道某人有一个自己的类是从Form派生的,但是我对此一无所知,则代码示例将使用:

So for example, if I know that someone has their own class deriving from Form, but I don't know anything else about it, a code example would use:

public class MyForm : Form

尽管如此,对于真实代码,我当然会坚决反对:)

I'd certainly take a firm stance against it for real code though :)

这篇关于关于使用My作为类名前缀的意见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆