Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

List of Framework interfaces in c#

Tags:

c#

interface

Newbie in c# there are many framework interfaces like iDisposable, Iqueryable,IEnumerable available which have different uses Is there a list available for such system interfaces which can be used as ready reference

like image 705
Vishal Avatar asked Sep 13 '10 10:09

Vishal


People also ask

WHAT IS interface in framework?

an interface-based framework is a framework giving the user/client lib access to interfaces only while actually delivering classes implementing those interfaces. The benefit of this approach consists in giving the implementor full control over the implementation and giving the client a stable API at the same time.

What are interfaces in C?

An interface contains definitions for a group of related functionalities that a non-abstract class or a struct must implement. An interface may define static methods, which must have an implementation. Beginning with C# 8.0, an interface may define a default implementation for members.

What is multiple interface in C#?

What is Interface? Interfaces in C# are provided as a replacement of multiple inheritance. Interface contains all abstract methods inherited by classes and structs, which must provide an implementation for each interface member declared.


1 Answers

WELL, below is a quick script I ran to scan my computer's .NET assemblies and find all the interface types defined within them

The output file was 1657 lines long*, so... you might want to narrow 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 to be honest, I don't even know how comprehensive this approach was.

like image 67
Dan Tao Avatar answered Sep 30 '22 18:09

Dan Tao