Пример #1
0
 public static TypeSelector ThatHaveAConstructorWithArguments(this TypeSelector types, params Type[] constructorArgs)
 {
     return
         (new TypeSelector(
              types
              .Where(t => t.GetConstructors().Any(c => HasArguments(c, constructorArgs))).ToList()));
 }
Пример #2
0
 /// <summary>
 /// Determines whether the namespace of type is exactly <paramref name="namespace"/>.
 /// </summary>
 public static TypeSelector ThatArePublicOrInternal(this TypeSelector types)
 {
     /*
      * The C# keywords protected and internal have no meaning in IL and are not used in the Reflection APIs.
      * The corresponding terms in IL are Family and Assembly. To identify an internal method using Reflection,
      * use the IsAssembly property. To identify a protected internal method, use the IsFamilyOrAssembly.*/
     return(new TypeSelector(types.Where(t => t.IsNestedAssembly || t.IsPublic).ToList()));
 }
Пример #3
0
 public static TypeSelector ThatHaveAConstructorWith(this TypeSelector types, Func <ConstructorInfo, bool> whereFunc)
 {
     return(new TypeSelector(types.Where(t => t.GetConstructors().Any(whereFunc)).ToList()));
 }
Пример #4
0
 public static TypeSelector ThatAreStructs(this TypeSelector types)
 {
     return(new TypeSelector(types.Where(t => t.IsValueType && !t.IsEnum).ToList()));
 }
Пример #5
0
 /// <summary>
 /// Determines whether the namespace of type is exactly <paramref name="namespace"/>.
 /// </summary>
 public static TypeSelector ThatArePublic(this TypeSelector types)
 {
     return(new TypeSelector(types.Where(t => t.IsPublic).ToList()));
 }