次の方法で共有


Linq Queries for .Net Framework members

How many members in the .Net framework contain the string ‘file” ?

Make a query like this:

        Dim q As Object

        q = From Assembly In AppDomain.CurrentDomain.GetAssemblies _

                From typ In Assembly.GetTypes _

                From Member In typ.GetMembers _

                Where Member.Name.ToLower.Contains("file") _

                Select Assembly, typ, Member.MemberType, Member.Name, Member.Module

This comes up with 1292!

Of course, you can use the Object Browser, but that’s not as much fun<g>

Sample results:

GetXmlNodeFilename

System.Configuration.ConfigurationException

HttpDataChunkFromFileHandle

System.Net.UnsafeNclNativeMethods+HttpApi+HTTP_DATA_CHUNK_TYPE

perfVSHelpXLinkIndexInitializeMergedFileCachedPageSlots

Microsoft.Internal.Performance.CodeMarkerEvent

Are there more properties or events?

        q = From Assembly In AppDomain.CurrentDomain.GetAssemblies _

                From typ In Assembly.GetTypes _

                From Member In typ.GetMembers _

                Group By Member.MemberType Into Count() Order By Count Descending

175434

Method

36564

Property

26779

Field

9826

Event

6474

Constructor

844

NestedType

How many static (shared in VB) members are there (those that can be called without an instance of the containing class, like System.IO.Directory.GetFiles)?

        q = From Assembly In AppDomain.CurrentDomain.GetAssemblies _

                From typ In Assembly.GetTypes _

                From Meth In typ.GetMethods _

                Where Meth.IsStatic _

                Select Assembly, typ, Meth.MemberType, Meth.Name, Meth.Module, Meth.IsStatic _

                Order By Name

Comments

  • Anonymous
    September 10, 2007
    So LINQ is out in strength and I've got to admit, even though I talked to Anders Hejlsberg over three

  • Anonymous
    September 10, 2007
    LINQ is out in strength and I&#39;ve got to admit, even though I talked to Anders Hejlsberg over three

  • Anonymous
    December 25, 2007
    The comment has been removed