Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a difference between Assembly.ExportedTypes and Assembly.GetExportedTypes()

The .NET Assembly class contains a method (GetExportedTypes()) and a property (ExportedTypes).

The documentation for these seems identical ("Returns a collection of all public visible types in the assembly"). Is there any difference between these ? or is this something related to historical reasons with the Assembly class's API ?

like image 877
lysergic-acid Avatar asked Aug 11 '13 19:08

lysergic-acid


1 Answers

Looking into .NET sources using ILSpy returns following ExportedTypes implementation:

public virtual IEnumerable<Type> ExportedTypes
{
    get
    {
        return this.GetExportedTypes();
    }
}

However, classes that inherits Assembly class can implement the property differently, so you probably shouldn't rely on GetExportedTypes() and ExportedTypes doing exactly the same thing.

like image 103
MarcinJuraszek Avatar answered Nov 02 '22 23:11

MarcinJuraszek