本文介绍了通用类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


有人可以帮我指出一些情况,我们会这样或者说b $ b必须使用Generic Class?

我可以预见Generic Method功能强大,但我找不到单一的

情况我需要Generic Class,因为有这么多其他

选项。


-

干杯,

RL

解决方案



没有你_need_使用泛型的情况,但它非常好

在某些情况下很方便,并提供更简单,更快速和更稳定的代码。


列表< Tclass例如使ArrayList过时,因为它确实是
$ b $同样的事情,只有更好。它的类型安全,易于使用,性能更好。


-

G?跑Andersson

_____





没有你需要使用泛型的情况,但在某些情况下它非常便宜
,并提供更简单,更快速和更稳定的代码。


列表< Tclass例如使ArrayList过时,因为它与

相同,只有b etter。它的类型安全,更易于使用,并且更好地执行



-

G?ran Andersson

_____



Hi all,

Can someone kindly enough point me to some situations that we shall or
"must" use Generic Class?
I can foresee the Generic Method is powerful, but I can not find a single
situation that I will need the Generic Class, given there are so many other
options.

--
cheers,
RL

解决方案

There is no situation where you _need_ to use generics, but it''s very
handy in some situations, and gives simpler, faster and more stable code.

The List<Tclass for example makes ArrayList obsolete, as it does the
same thing, only better. It''s type safe, easier to use, and performs better.

--
G?ran Andersson
_____
http://www.guffa.com




There is no situation where you _need_ to use generics, but it''s very
handy in some situations, and gives simpler, faster and more stable code.

The List<Tclass for example makes ArrayList obsolete, as it does the
same thing, only better. It''s type safe, easier to use, and performs
better.

--
G?ran Andersson
_____
http://www.guffa.com



这篇关于通用类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-25 18:32