當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。