Class AssemblyExtension

Extension methods to simplify working with assemblies

Inheritance
System.Object
AssemblyExtension
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Framework.Initialization
Assembly: EPiServer.Framework.dll
Version: 8.11.0
Syntax
public static class AssemblyExtension

Methods

IsDynamicAssembly(Assembly)

Determines whether the specified assembly is a dynamically generated assembly.

Declaration
public static bool IsDynamicAssembly(this Assembly assembly)
Parameters
Type Name Description
System.Reflection.Assembly assembly

The assembly to check.

Returns
Type Description
System.Boolean

true if it is a dynamic assembly; otherwise, false.

Remarks

This extension method checks more than just the IsDynamic property, which does not cover all relevant cases of dynamic assemblies.

IsEPiServerSignedAssembly(Assembly)

Determines whether the specified assembly is signed by EPiServer. This method is used to determine if an assembly is a part of EPiServer products family.

Declaration
public static bool IsEPiServerSignedAssembly(this Assembly assembly)
Parameters
Type Name Description
System.Reflection.Assembly assembly

The assembly.

Returns
Type Description
System.Boolean

true if the specified assembly is signed by EPiServer; otherwise, false.

IsNetFrameworkAssembly(Assembly)

Determines whether the specified assembly is a .NET Framework assembly.

Declaration
public static bool IsNetFrameworkAssembly(this Assembly assembly)
Parameters
Type Name Description
System.Reflection.Assembly assembly

The assembly to check.

Returns
Type Description
System.Boolean

true if it is a .NET Framework assembly; otherwise, false.

IsSameAssemblyName(AssemblyName, AssemblyName)

Compares assembly names based on name and public key token. Returns true if name and public key token of this assembly are equal.

Declaration
public static bool IsSameAssemblyName(this AssemblyName assemblyName, AssemblyName assemblyName2)
Parameters
Type Name Description
System.Reflection.AssemblyName assemblyName

The assembly name.

System.Reflection.AssemblyName assemblyName2

The assembly name for comparison.

Returns
Type Description
System.Boolean

IsScanAllowed(Assembly)

Determines whether the specified assembly is allowed for type/attribute scanning.

Declaration
public static bool IsScanAllowed(this Assembly assembly)
Parameters
Type Name Description
System.Reflection.Assembly assembly

The assembly to check.

Returns
Type Description
System.Boolean

true if scan is allowed; otherwise, false.

Remarks

Any dynamic or .NET Framework assembly will be excluded, as well as any assembly that contains the [PreventAssemblyScan] attribute.

NormalizedName(Assembly)

Normalizes the assembly name.

Declaration
public static string NormalizedName(this Assembly assembly)
Parameters
Type Name Description
System.Reflection.Assembly assembly

The assembly.

Returns
Type Description
System.String

A normalized version of the assembly display name.