List of Framework Interfaces in C #

New to C # there are many interface interfaces, such as iDisposable, Iqueryable, IEnumerable, which have different uses. Is there a list of available for such system interfaces that can be used as ready-made links

+6
c # interface
source share
4 answers

WELL , below is a quick script I ran to test my .NET assemblies on a computer and find all types of interfaces defined inside them

The output file was 1657 lines long *, so ... you can shorten your search a bit;)

Console.Write("Enter a path to write the list of interfaces to: "); string savePath = Console.ReadLine(); var errors = new List<string>(); using (var writer = new StreamWriter(savePath)) { string dotNetPath = @"C:\Windows\Microsoft.NET\Framework"; string[] dllFiles = Directory.GetFiles(dotNetPath, "*.dll", SearchOption.AllDirectories); foreach (string dllFilePath in dllFiles) { try { Assembly assembly = Assembly.LoadFile(dllFilePath); var interfaceTypes = assembly.GetTypes() .Where(t => t.IsInterface); foreach (Type interfaceType in interfaceTypes) { writer.WriteLine(interfaceType.FullName); Console.WriteLine(interfaceType.FullName); } } catch { errors.Add(string.Format("Unable to load assembly '{0}'.", dllFilePath)); } } } foreach (string err in errors) { Console.WriteLine(err); } Console.ReadLine(); 

* And, frankly, I don’t even know how comprehensive this approach was.

+7
source share

Well, many are very imposed on specific goals. If you specified all of them, it will take some time.

The main ones that I would add to the above are IList / IList<T> (sets / collections / lists), IDictionary<TKey,TValue> , IEnumerable<T> (common version of IEnumerable ) and IEnumerator (plus a common double, though in truth, few people need to encode IEnumerator code).

If you want to go to any area, it would be much more than you will quickly come across - things like IDbCommand / IDataReader for data access, etc., but not only interfaces are important. Things like Stream are a class (albeit abstract), but extremely .

I think the best question / tactic might be "given what I do [concrete X], what important types to know about?". Since we do not know [specific X], we cannot answer so much.

+5
source share

Here is the .NET Framework class library documentation

http://msdn.microsoft.com/en-us/library/ms229335.aspx

By clicking on the selected namespace, you will see the interfaces defined in this namespace. In my modest oppinion, such a categorized list is much more convenient to use as a reference than just a simple list of interfaces.

+4
source share

Here are some LINQs to get a set of interfaces where "files" is an array of libraries to search for .....

  var interfaces = (from fileName in files select Assembly.LoadFile(fileName) into assembly select assembly.GetTypes() into typesInAssembly from interfacesInType in typesInAssembly.Select(type => type.GetInterfaces()) from interfaceInType in interfacesInType select interfaceInType) .Distinct() .OrderBy( i => i.Name); 
0
source share

All Articles