System Library Common Framework
Search Results for

    *.Benchmark*,*.Tests*,*.ApiTests*,*.BaseTest*,DelegateJsonConverter,CalleeCancelledRequestException,ClientResponse,ContentType,OutputCachePolicy
    Show / Hide Table of Contents Show / Hide Table of Contents
    NamespaceSystemLibrary.Common.Framework SystemLibrary.Common.Framework.Net.dll

    Static functions on whitelisted loaded assemblies

    Remarks
    X

    Built on top of System.Reflection.Assembly

    Assemblies

    public static class Assemblies

    Inheritance
    object
    Assemblies
    Examples
    Arguments
    X

    Methods

    Find all types that inherit from or implement T and have an attribute, in all whitelisted loaded assemblies.

    Remarks
    X

    Skip searching in known assemblies with names starting with Microsoft, System, EntityFramework, AWS, Serilog, MSTest, NUnit, Newtonsoft, Xamarin, Dapper, Autofac, AutoMapper, Salesforce, and others.

    public static IEnumerable<Type> FindAllTypesInheritingWithAttribute<TClassType, TAttributeType>() where TClassType : class where TAttributeType : Attribute

    X
    public class NameAttribute : Attribute { 
    }
    
    [NameAttribute]
    public class Car : IVehicle {
    }
    
    var vehicles = Assemblies.FindAllTypesInheriting<IVehicle,NameAttribute>
    // Returns Car and all other types that inherit from or implement IVehicle, which also have the attribute.
    X
    Generic types
    Name Description
    TClassType

    Class

    TAttributeType

    Attribute

    X
    Type Description
    IEnumerable<Type>

    IEnumerable of System.Type

    Find all types that inherit from or implement T in all whitelisted loaded assemblies.

    Remarks
    X

    Skip searching in known assemblies with names starting with Microsoft, System, EntityFramework, AWS, Serilog, MSTest, NUnit, Newtonsoft, Xamarin, Dapper, Autofac, AutoMapper, Salesforce, and others.

    public static IEnumerable<Type> FindAllTypesInheriting<TClassType>() where TClassType : class

    X
    public class Car : IVehicle {
    }
    var vehicles = Assemblies.FindAllTypesInheriting<IVehicle>
    // Returns Car and all other types that inherit from or implement IVehicle.
    X
    Generic types
    Name Description
    TClassType
    X
    Type Description
    IEnumerable<Type>

    IEnumerable of System.Type

    Read the content of an embedded resource as a string.

    Remarks
    X

    Searches only in a single assembly, defaulting to 'CallingAssembly'.

    public static string GetEmbeddedResource(string relativeName, Assembly assembly = null)

    X
    var text = Assemblies.GetEmbeddedResource("Folder/SubFolder/SubFolder2/json.text");
    Assert.IsTrue(text.Contains("hello world"));
    // assume a file in Solution Explorer exists at "~/Folder/SubFolder/SubFolder2/json.txt"
    // assume "json.txt" has build action 'Embedded Resource'
    // assume "json.txt" contains 'hello world' this is now true
    X
    Methods arguments
    Type Name Description
    string relativeName
    Assembly assembly
    X
    Type Description
    string

    Read the content of an embedded resource as a byte[].

    Remarks
    X

    Built on top of System.Reflection.Assembly

    public static byte[] GetEmbeddedResourceAsBytes(string relativeName, Assembly assembly = null)

    X
    var bytes = Assemblies.GetEmbeddedResourceAsBytes("Folder/SubFolder/SubFolder2/image.png");
    // The bytes array now contains the entire image.jpg file as a byte array, assuming image.jpg was marked with the build action 'Embedded Resource'.
    X
    Methods arguments
    Type Name Description
    string relativeName
    Assembly assembly
    X
    Type Description
    byte[]

    }

    In This Article
    Package: nuget
    Source: github
    Website: System Library Common Framework