要使用“I”前缀接口或不 [英] To use the 'I' prefix for interfaces or not to

查看:199
本文介绍了要使用“I”前缀接口或不的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是个问题?赎罪那么它有多大不是开发一个C#项目时使用此惯例?这种约定广泛用于.NET类库。不过,我不是一个球迷,至少可以说,不只是为了asthetic原因,但我不认为这有什么贡献。例如IPSec的皮秒的接口?是IOPConnection的IIOPConnection的接口,我通常会去定义,找出反正。

That is the question? So how big a sin is it not to use this convention when developing a c# project? This convention is widely used in the .NET class library. However, I am not a fan to say the least, not just for asthetic reasons but I don't think it makes any contribution. For example is IPSec an interface of PSec? Is IIOPConnection An interface of IOPConnection, I usually go to the definition to find out anyway.


  • 因此不会使用这个约定造成混乱?

  • 是否有任何C#项目或库注意,降本公约?

  • 请任何C#项目的混合公约,可惜的Apache Wicket的呢?

图书馆已经没有这个存在多年的Java类,我不觉得我曾经努力没有它读取的代码。此外,如果接口不是最原始的描述?我的意思的IList< T>为名单℃的接口; T>在C#中,难道不是最好有列表< T>和LinkedList< T>或ArrayList的< T>甚至的CopyOnWriteArrayList< T> ;?这些类描述实现?我想我在这里获得更多的信息,比我从名单<做; T>在C#。

The Java class libraries have existed without this for many years, I don't feel I have ever struggled to read code without it. Also, should the interface not be the most primitive description? I mean IList<T> as an interface for List<T> in c#, is it not better to have List<T> and LinkedList<T> or ArrayList<T> or even CopyOnWriteArrayList<T>? The classes describe the implementation? I think I get more information here, than I do from List<T> in c#.

推荐答案

Java和C#的区别是Java可以让你轻松辨别是否实现一个接口或延长类,因为它有相应的关键字工具扩展

The difference between Java and C# is that Java allows you to easily distinguish whether you implement an interface or extend a class since it has the corresponding keywords implements and extends.

由于C#不仅具有来表达或者实现或扩展,我建议标准以下和接口的名字前加上一个I

As C# only has the : to express either an implementation or extension, I recommend following the standard and put an I before an interface's name.

这篇关于要使用“I”前缀接口或不的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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