namespace ImageProcessor.Common.Extensions
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
///
/// Encapsulates a series of time saving extension methods to the class.
///
public static class AssemblyExtensions
{
///
/// Gets a collection of loadable types from the given assembly.
/// Adapted from
///
///
/// The to load the types from.
///
///
/// The loadable .
///
public static IEnumerable GetLoadableTypes(this Assembly assembly)
{
if (assembly == null)
{
throw new ArgumentNullException("assembly");
}
try
{
return assembly.GetTypes();
}
catch (ReflectionTypeLoadException ex)
{
return ex.Types.Where(t => t != null);
}
}
}
}