コード例 #1
0
 private Type FindTypeBySchemaTypeName(MessageName messageName)
 {
     // Search through all of the types in the current app domain for
     // a type whose schema type name is equal to the message name
     return(_reflectionService
            .EnumerateTypes()
            .Where(t => !t.IsGenericTypeDefinition)
            .FirstOrDefault(type => type.Has <DataContractAttribute>() &&
                            GetSchemaTypeName(type) == messageName));
 }
コード例 #2
0
 /// <summary>
 /// Finds types with the specified <paramref name="typeName"/>
 /// </summary>
 /// <param name="reflectionService">The reflection service</param>
 /// <param name="typeName">The type name</param>
 /// <returns>Returns the types with the specified <paramref name="typeName"/></returns>
 public static IEnumerable <Type> FindTypesByName(this IReflectionService reflectionService, string typeName)
 {
     return(reflectionService.EnumerateTypes()
            .Where(t => Equals(t.FullName, typeName)));
 }
コード例 #3
0
 /// <summary>
 /// Finds non-abstract implementations or subtypes of the specified base type
 /// <typeparamref name="TBase"/>
 /// </summary>
 /// <typeparam name="TBase">The base type</typeparam>
 /// <param name="reflectionService">The reflection service</param>
 /// <returns>Returns non-abstract implementations or subtypes of <typeparamref name="TBase"/></returns>
 public static IEnumerable <Type> FindConcreteSubtypes <TBase>(this IReflectionService reflectionService)
 {
     return(reflectionService.EnumerateTypes()
            .Where(typeof(TBase).IsAssignableFrom)
            .Where(t => !t.IsInterface && !t.IsAbstract));
 }