是什么在C#中最常用的接口? [英] what are the most used interfaces in C#?
本文介绍了是什么在C#中最常用的接口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图寻找在C#中最常用的内置接口,也没有找到一篇文章,所以我想我们可以回顾一下这里。
I tried searching for the most used built-in interfaces in C#, but couldn't find an article, so I thought we may recap here.
让我们用在回答以下约定:
Let's use the following convention in the answers:
IinterfaceName1:此
IinterfaceName1: for this
IinterfaceName2:为
IinterfaceName2: for that
推荐答案
在我脑海中的前两名必须是那些有语言支持:
The top two in my mind have to be ones with language support:
-
的IEnumerable< T>
(和的IEnumerable
)与
使用的foreach
和LINQ -
的IDisposable
:对于需要
清理资源,使用与使用
IEnumerable<T>
(andIEnumerable
): for use withforeach
and LINQIDisposable
: for resources requiring cleanup, used withusing
除此之外...
-
IComparable的< T>
和的IComparer< T>
:广义排序 -
IEquatable< T>
和的IEqualityComparer< T>
:广义平等 -
的IList< T>
和的ICollection< T>
:对于可变集合 -
的IDictionary< T,K>
:用于查找集合
IComparable<T>
andIComparer<T>
: for generalized sortingIEquatable<T>
andIEqualityComparer<T>
: for generalized equalityIList<T>
andICollection<T>
: for mutable collectionsIDictionary<T,K>
: for lookup collections
这篇关于是什么在C#中最常用的接口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文