@ -292,7 +292,7 @@ namespace ICSharpCode.Decompiler.TypeSystem
@@ -292,7 +292,7 @@ namespace ICSharpCode.Decompiler.TypeSystem
/// Gets all type definitions in the compilation.
/// This may include types from referenced assemblies that are not accessible in the main assembly.
/// </summary>
public static IEnumerable < ITypeDefinition > GetAllTypeDefinitions ( this ICompilation compilation )
public static IEnumerable < ITypeDefinition > GetAllTypeDefinitions ( this ICompilation compilation )
{
return compilation . Modules . SelectMany ( a = > a . TypeDefinitions ) ;
}
@ -301,7 +301,7 @@ namespace ICSharpCode.Decompiler.TypeSystem
@@ -301,7 +301,7 @@ namespace ICSharpCode.Decompiler.TypeSystem
/// Gets all top level type definitions in the compilation.
/// This may include types from referenced assemblies that are not accessible in the main assembly.
/// </summary>
public static IEnumerable < ITypeDefinition > GetTopLevelTypeDefinitions ( this ICompilation compilation )
public static IEnumerable < ITypeDefinition > GetTopLevelTypeDefinitions ( this ICompilation compilation )
{
return compilation . Modules . SelectMany ( a = > a . TopLevelTypeDefinitions ) ;
}
@ -390,7 +390,7 @@ namespace ICSharpCode.Decompiler.TypeSystem
@@ -390,7 +390,7 @@ namespace ICSharpCode.Decompiler.TypeSystem
/// (if the given <paramref name="entity"/> in an <c>override</c>)
/// should be returned.
/// </param>
public static bool HasAttribute ( this IEntity entity , KnownAttribute attributeType , bool inherit = false )
public static bool HasAttribute ( this IEntity entity , KnownAttribute attributeType , bool inherit = false )
{
return GetAttribute ( entity , attributeType , inherit ) ! = null ;
}
@ -410,7 +410,7 @@ namespace ICSharpCode.Decompiler.TypeSystem
@@ -410,7 +410,7 @@ namespace ICSharpCode.Decompiler.TypeSystem
/// If inherit is true, an from the entity itself will be returned if possible;
/// and the base entity will only be searched if none exists.
/// </returns>
public static IAttribute GetAttribute ( this IEntity entity , KnownAttribute attributeType , bool inherit = false )
public static IAttribute GetAttribute ( this IEntity entity , KnownAttribute attributeType , bool inherit = false )
{
return GetAttributes ( entity , inherit ) . FirstOrDefault ( a = > a . AttributeType . IsKnownType ( attributeType ) ) ;
}
@ -478,8 +478,8 @@ namespace ICSharpCode.Decompiler.TypeSystem
@@ -478,8 +478,8 @@ namespace ICSharpCode.Decompiler.TypeSystem
public static ITypeDefinition GetTypeDefinition ( this IModule module , string namespaceName , string name , int typeParameterCount = 0 )
{
if ( module = = null )
throw new ArgumentNullException ( "assembly" ) ;
return module . GetTypeDefinition ( new TopLevelTypeName ( namespaceName , name , typeParameterCount ) ) ;
throw new ArgumentNullException ( "assembly" ) ;
return module . GetTypeDefinition ( new TopLevelTypeName ( namespaceName , name , typeParameterCount ) ) ;
}
#endregion
@ -560,7 +560,12 @@ namespace ICSharpCode.Decompiler.TypeSystem
@@ -560,7 +560,12 @@ namespace ICSharpCode.Decompiler.TypeSystem
public static IModule FindModuleByReference ( this ICompilation compilation , IAssemblyReference assemblyName )
{
foreach ( var module in compilation . Modules ) {
if ( module . FullAssemblyName = = assemblyName . FullName ) {
if ( string . Equals ( module . FullAssemblyName , assemblyName . FullName , StringComparison . OrdinalIgnoreCase ) ) {
return module ;
}
}
foreach ( var module in compilation . Modules ) {
if ( string . Equals ( module . Name , assemblyName . Name , StringComparison . OrdinalIgnoreCase ) ) {
return module ;
}
}