当前位置: 首页>>代码示例>>C#>>正文


C# Type.Where方法代码示例

本文整理汇总了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);
        }
开发者ID:SaladLab,项目名称:Akka.Interfaced,代码行数:13,代码来源:EntryCodeGenerator.cs

示例2: GetServiceSpecification

 static Type GetServiceSpecification(Type[] types)
 {
     return types
         .Where(x => x.HasInterface<IServiceSpecification>())
         .DefaultIfEmpty(typeof(DefaultServiceSpecification))
         .FirstOrDefault();
 }
开发者ID:kotvisbj,项目名称:MassTransit,代码行数:7,代码来源:AssemblyRegistration.cs

示例3: CheckTables

 public void CheckTables(Type[] types, int unitNumber)
 {
     foreach (var type in types.Where(type => !TableExist(type.Name + unitNumber.ToString())))
     {
         CreateTable(type);
     }
 }
开发者ID:pulse-computer-consulting,项目名称:NucleusPub,代码行数:7,代码来源:DBLayer.cs

示例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();
 }
开发者ID:kicholen,项目名称:SpaceShooter,代码行数:8,代码来源:TypeReflectionProvider.cs

示例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;
 }
开发者ID:leohinojosa,项目名称:spec,代码行数:8,代码来源:TypeIndex.cs

示例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();
 }
开发者ID:ariessanchezsulit,项目名称:Entitas-CSharp,代码行数:8,代码来源:CodeGenerator.cs

示例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;
 }
开发者ID:hotstone,项目名称:femah,代码行数:15,代码来源:FemahFluentConfiguration.cs

示例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();
 }
开发者ID:jamierytlewski,项目名称:newrelic_microsoft_sqlserver_plugin,代码行数:9,代码来源:QueryLocator.cs

示例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;
 }
开发者ID:rodrigoelp,项目名称:NSubstitute,代码行数:9,代码来源:SubstituteFactory.cs

示例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");
        }
开发者ID:veatchje,项目名称:Siftables-477,代码行数:9,代码来源:AppRunner.cs

示例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);
            }
        }
开发者ID:alienblog,项目名称:Rc,代码行数:11,代码来源:MapperBootstrapper.cs

示例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();
 }
开发者ID:thebatoust,项目名称:EntitasTurnBasedGame,代码行数:11,代码来源:ComponentExtensionsGenerator.cs

示例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();
 }
开发者ID:namlunoy,项目名称:Entitas-CSharp,代码行数:12,代码来源:ComponentExtensionsGenerator.cs

示例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();
 }
开发者ID:ariessanchezsulit,项目名称:Entitas-CSharp,代码行数:12,代码来源:SystemsGenerator.cs

示例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();
        }
开发者ID:blackbarlabs,项目名称:BlackBarLabs.Web,代码行数:13,代码来源:UrnExtensions.cs


注:本文中的System.Type.Where方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。