本文整理汇总了C#中System.Type.Where方法的典型用法代码示例。如果您正苦于以下问题:C# Type.Where方法的具体用法?C# Type.Where怎么用?C# Type.Where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Type
的用法示例。
在下文中一共展示了Type.Where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenerateCode
public void GenerateCode(Type[] types)
{
var actorTypes = types.Where(t => Utility.IsActorInterface(t)).ToArray();
var observerTypes = types.Where(t => Utility.IsObserverInterface(t)).ToArray();
var actorCodeGen = new InterfacedActorCodeGenerator() { Options = Options };
foreach (var type in actorTypes)
actorCodeGen.GenerateCode(type, CodeWriter);
var observerCodeGen = new InterfacedObserverCodeGenerator() { Options = Options };
foreach (var type in observerTypes)
observerCodeGen.GenerateCode(type, CodeWriter);
}
示例2: GetServiceSpecification
static Type GetServiceSpecification(Type[] types)
{
return types
.Where(x => x.HasInterface<IServiceSpecification>())
.DefaultIfEmpty(typeof(DefaultServiceSpecification))
.FirstOrDefault();
}
示例3: CheckTables
public void CheckTables(Type[] types, int unitNumber)
{
foreach (var type in types.Where(type => !TableExist(type.Name + unitNumber.ToString())))
{
CreateTable(type);
}
}
示例4: GetComponentInfos
public static ComponentInfo[] GetComponentInfos(Type[] types)
{
return types
.Where(type => !type.IsInterface)
.Where(type => type.GetInterfaces().Any(i => i.FullName == "Entitas.IComponent"))
.Select(type => CreateComponentInfo(type))
.ToArray();
}
示例5: TargetTypesToRun
public static Type[] TargetTypesToRun(Type[] availableTypes)
{
var targetTypesToRun = availableTypes
.Where(t => !t.IsAbstract && t.IsSubclassOf(typeof(Spec)))
.Select(t => t)
.ToArray();
return targetTypesToRun;
}
示例6: GetSystems
public static Type[] GetSystems(Type[] types) {
return types
.Where(type => !type.IsInterface
&& type != typeof(ReactiveSystem)
&& type != typeof(Systems)
&& type.GetInterfaces().Contains(typeof(ISystem)))
.ToArray();
}
示例7: WithSelectedFeatureSwitchTypes
/// <summary>
/// Provides the ability to pass in and configure femah with a predefined collection of FeatureSwitchTypes, i.e. those
/// types implementing IFeatureSwitch. Predominantly used for unit testing purposes, allowing us to configure femah with
/// a known subset of FeatureSwitchTypes.
/// </summary>
/// <param name="types" type="Type[]">An array containing the FeatureSwitchTypes to configure</param>
/// <returns type="FemahFluentConfiguration" />
public FemahFluentConfiguration WithSelectedFeatureSwitchTypes(Type[] types)
{
foreach (var t in types.Where(t => t.GetInterfaces().Contains(typeof(IFeatureSwitch))))
{
_config.StandardSwitchTypes.Add(t);
}
return this;
}
示例8: PrepareQueries
public IEnumerable<SqlQuery> PrepareQueries(Type[] types, bool onlyEnabledQueries = true)
{
// Search for types with at least one attribute that have a QueryAttribute
return types.Where(t => !_ignoreTypes.Contains(t))
.SelectMany(t => t.GetCustomAttributes<QueryAttribute>()
.Where(a => !onlyEnabledQueries || a.Enabled)
.Select(a => new SqlQuery(t, a, _dapper)))
.ToArray();
}
示例9: Create
public object Create(Type[] typesToProxy, object[] constructorArguments)
{
var callRouter = _callRouterFactory.Create(_context);
var primaryProxyType = GetPrimaryProxyType(typesToProxy);
var additionalTypes = typesToProxy.Where(x => x != primaryProxyType).ToArray();
var proxy = _proxyFactory.GenerateProxy(callRouter, primaryProxyType, additionalTypes, constructorArguments);
_callRouterResolver.Register(proxy, callRouter);
return proxy;
}
示例10: FindBaseApp
public BaseApp FindBaseApp(Type[] assemblyTypes)
{
foreach (var t in assemblyTypes.Where(t => t.BaseType == typeof(BaseApp)))
{
return (BaseApp) Activator.CreateInstance(t);
}
throw new TypeLoadException("No class found subclassing BaseApp");
}
示例11: ConfigureMapper
public static void ConfigureMapper(Type[] types)
{
var mapTypes = types.Where(t=>IsDefined(t,typeof(AutoMapAttribute))
||IsDefined(t,typeof(AutoMapFromAttribute))
||IsDefined(t,typeof(AutoMapToAttribute)));
foreach (var type in mapTypes)
{
MapType(type);
}
}
示例12: Generate
public CodeGenFile[] Generate(Type[] components) {
return components
.Where(shouldGenerate)
.Aggregate(new List<CodeGenFile>(), (files, type) => {
files.Add(new CodeGenFile {
fileName = type + CLASS_SUFFIX,
fileContent = generateComponentExtension(type).ToUnixLineEndings()
});
return files;
}).ToArray();
}
示例13: Generate
public CodeGenFile[] Generate(Type[] components)
{
return components
.Where(shouldGenerate)
.Aggregate(new List<CodeGenFile>(), (files, type) => {
files.Add(new CodeGenFile {
fileName = type + classSuffix,
fileContent = generateComponentExtension(type)
});
return files;
}).ToArray();
}
示例14: Generate
public CodeGenFile[] Generate(Type[] systems) {
return systems
.Where(type => type.GetConstructor(new Type[0]) != null)
.Aggregate(new List<CodeGenFile>(), (files, type) => {
files.Add(new CodeGenFile {
fileName = type + CLASS_SUFFIX,
fileContent = string.Format(CLASS_TEMPLATE, type.Name, type).ToUnixLineEndings()
});
return files;
})
.ToArray();
}
示例15: ParseUrnQuery
public static ResourceQuery ParseUrnQuery(this Uri urn, Type [] models)
{
var urlModelLookup = models
.Where(type => type.ContainsCustomAttribute<ResourceTypeAttribute>())
.Select(type =>
{
var resourceTypeAttr = type.GetCustomAttribute<ResourceTypeAttribute>();
return new KeyValuePair<string, Type>(resourceTypeAttr.Urn, type);
})
.ToDictionary();
return new ResourceQuery();
}