本文整理汇总了C#中System.Reflection.Assembly.Types方法的典型用法代码示例。如果您正苦于以下问题:C# Assembly.Types方法的具体用法?C# Assembly.Types怎么用?C# Assembly.Types使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Reflection.Assembly
的用法示例。
在下文中一共展示了Assembly.Types方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ListExtensions
//static void Main()
//{
// Console.WriteLine( AssemblyInfoWriter.ListExtensions( Assembly.GetAssembly( typeof(Flags) ) ) );
//}
public static string ListExtensions( Assembly assembly )
{
var sb = new StringBuilder();
sb.AppendFormat( "=== Extension methods (all):{0}", Environment.NewLine );
IList<Type> types = assembly.Types( Flags.PartialNameMatch, "Extensions" );
types.ForEach( t => Write( sb, t, t.Methods( Flags.Static | Flags.Public ).OrderBy( m => m.Name ).ToList() ) );
return sb.ToString();
}
示例2: ListExtensionMethodsWithSuperfluousOverloads
public static string ListExtensionMethodsWithSuperfluousOverloads( Assembly assembly )
{
var sb = new StringBuilder();
sb.AppendFormat( "=== Extension methods that are superfluous:{0}", Environment.NewLine );
IList<Type> types = assembly.Types( Flags.PartialNameMatch, "Extensions" );
types.ForEach( t => Write( sb, t, t.Methods( Flags.Static | Flags.Public )
.OrderBy( m => m.Name )
.Where( m => IsSuperfluous( m, t.Methods( Flags.Static | Flags.Public, m.Name ) ) )
.ToList() ) );
return sb.ToString();
}
示例3: ListExtensionMethodsWhereParametersViolateConventions
public static string ListExtensionMethodsWhereParametersViolateConventions( Assembly assembly )
{
var sb = new StringBuilder();
sb.AppendFormat( "=== Extension methods with naming violations:{0}", Environment.NewLine );
IList<Type> types = assembly.Types( Flags.PartialNameMatch, "Extensions" );
types.ForEach( t => Write( sb, t, t.Methods( Flags.Static | Flags.Public )
.OrderBy( m => m.Name )
.Where(
m => IsParameterViolation( typeof(Flags), "bindingFlags", true, m.Parameters() ) )
.ToList() ) );
return sb.ToString();
}
示例4: Setup
/// <summary>
/// Scans the assembly for mapping modules and creates them
/// </summary>
/// <param name="ModuleAssembly"></param>
public void Setup(Assembly ModuleAssembly)
{
IEnumerable<Type> Modules = ModuleAssembly.Types(typeof(IModule));
List<IModule> TempModules = new List<IModule>();
foreach (Type Module in Modules)
{
if (!Module.IsInterface && !Module.IsAbstract)
TempModules.Add((IModule)Module.Assembly.CreateInstance(Module.FullName));
}
foreach (IModule Module in TempModules)
{
Module.Manager = this;
Module.Setup();
}
this.Modules.Add(TempModules);
}
示例5: From
/// <summary>
/// Returns a <see cref="TypeSelector"/> for selecting the types that are visible outside the
/// specified <paramref name="assembly"/>.
/// </summary>
/// <param name="assembly">The assembly from which to select the types.</param>
public static TypeSelector From(Assembly assembly)
{
return assembly.Types();
}
示例6: Setup
/// <summary>
/// Sets up the mappings
/// </summary>
/// <param name="AssemblyUsing">Assembly using</param>
private void Setup(Assembly AssemblyUsing)
{
if (Mappings == null)
Mappings = new ListMapping<Type, IMapping>();
IEnumerable<Type> Types = AssemblyUsing.Types(typeof(IMapping));
foreach (Type Type in Types)
{
Type BaseType = Type.BaseType;
IMapping TempObject = (IMapping)AssemblyUsing.CreateInstance(Type.FullName);
TempObject.Manager = this;
Mappings.Add(BaseType.GetGenericArguments()[0], TempObject);
}
}