谁能给我一个很好的理由使用CLR类型名称,而不是代码的C#类型名称(别名)(作为一般的做法)? [英] Can anyone give me a REALLY good reason to use CLR type names instead of C# type names (aliases) in code (as a general practice)?

查看:134
本文介绍了谁能给我一个很好的理由使用CLR类型名称,而不是代码的C#类型名称(别名)(作为一般的做法)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一点战斗在我们的开发团队在这个事情。我很想听听别人怎么想这个问题。

We have a bit of a battle going on in our development team over this. I would love to hear what others think about this.

推荐答案

在实际的代码?不,除非你将有很多的人谁是熟悉.NET但与C#代码工作。

In the actual code? No, not unless you're going to have lots of people working on the code who are familiar with .NET but not with C#.

在成员名字?绝对。例如,假设 Convert.ToSingle 被称为 Convert.ToFloat - 这将是F#开发人员完全混乱,对于其中浮动是指64位浮点。

In member names? Absolutely. For instance, suppose Convert.ToSingle had been called Convert.ToFloat - that would be totally confusing for F# developers, for whom "float" means "64 bit floating point".

我的一般原则是实现C#别名,CLR类型成员的名称。

My general rule is C# aliases for implementation, CLR types for member names.

如果你想找到一些论点支持无处不使用CLR类型名称,杰夫里氏建议,通过C#CLR。 (如果你还没有得到它,买一本不管这件事情 - 这是一个奇妙的书)。我没跟他提出的论点一致,但也有一些在那里,反正

If you want to find some arguments in favour of using the CLR type names everywhere, Jeff Richter recommends that in "CLR via C#". (If you haven't already got it, buy a copy regardless of this matter - it's a wonderful book.) I didn't agree with the arguments he put forward, but there are some there, anyway.

这篇关于谁能给我一个很好的理由使用CLR类型名称,而不是代码的C#类型名称(别名)(作为一般的做法)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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