是什么在C#中最常用的接口? [英] what are the most used interfaces in C#?

查看:110
本文介绍了是什么在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> (and IEnumerable): for use with foreach and LINQ
  • IDisposable: for resources requiring cleanup, used with using

除此之外...


  • IComparable的< T> 的IComparer< T> :广义排序

  • IEquatable< T> 的IEqualityComparer< T> :广义平等

  • 的IList< T> 的ICollection< T> :对于可变集合

  • 的IDictionary< T,K> :用于查找集合

  • IComparable<T> and IComparer<T>: for generalized sorting
  • IEquatable<T> and IEqualityComparer<T>: for generalized equality
  • IList<T> and ICollection<T>: for mutable collections
  • IDictionary<T,K>: for lookup collections

这篇关于是什么在C#中最常用的接口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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