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


C# IEnumerable.Apply方法代码示例

本文整理汇总了C#中IEnumerable.Apply方法的典型用法代码示例。如果您正苦于以下问题:C# IEnumerable.Apply方法的具体用法?C# IEnumerable.Apply怎么用?C# IEnumerable.Apply使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IEnumerable的用法示例。


在下文中一共展示了IEnumerable.Apply方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Setup

        public void Setup(IEnumerable<Type> typesToRegister, IEnumerable<Type> viewModelTypesToRegister)
        {
            typesToRegister.Apply(container.Register);
            viewModelTypesToRegister.Apply(container.Register);

            this.viewModelTypes = new HashSet<Type>(viewModelTypesToRegister);
        }
开发者ID:distantcam,项目名称:zeromvvm,代码行数:7,代码来源:Container.cs

示例2: ModuleConfig

        public IDictionary<string, object> ModuleConfig(IEnumerable<ModuleData> modules)
        {
            var moduleConfig = new Dictionary<string, object>();
            modules.Apply(module => moduleConfig[module.Name] = module.Config());

            var container = new Dictionary<string, object>();
            container["remoteModuleConfig"] = moduleConfig;
            return container;
        }
开发者ID:joemcbride,项目名称:react-native-wpf,代码行数:9,代码来源:ModuleLoader.cs

示例3: Draw

        private static void Draw(
			Graphics graphics, 
			Rectangle canvasRectangle, 
			Func<IEnumerable<SizeF>, Rectangle, IEnumerable<Rectangle>> arrangeRectangles,
			IEnumerable<WordModel> wordModels,
			String fontName)
        {
            var wordsData = wordModels.Apply(
                models => arrangeRectangles(models.Select(model => GetWordSize(graphics, model, fontName)), canvasRectangle),
                (model, rect) => Tuple.Create(model.Word, new Font(fontName, model.Size), rect));
            DrawWords(graphics, wordsData);
        }
开发者ID:mpivko,项目名称:03-design-hw,代码行数:12,代码来源:FormWordCloudVisualiser.cs

示例4: InMemoryDatabaseTestFixtureBase

        protected InMemoryDatabaseTestFixtureBase(IEnumerable<Assembly> assemblies)
        {
            Configuration = new Configuration()
                .SetProperty(NHibernate.Cfg.Environment.ReleaseConnections, "on_close")
                .SetProperty(NHibernate.Cfg.Environment.Dialect, typeof(SQLiteDialect).AssemblyQualifiedName)
                .SetProperty(NHibernate.Cfg.Environment.ConnectionDriver, typeof(SQLite20Driver).AssemblyQualifiedName)
                .SetProperty(NHibernate.Cfg.Environment.ConnectionString, "data source=:memory:")
                .SetProperty(NHibernate.Cfg.Environment.ProxyFactoryFactoryClass, typeof(ProxyFactoryFactory).AssemblyQualifiedName);

            assemblies.Apply(assembly => Configuration.AddAssembly(assembly));

            SessionFactory = Configuration.BuildSessionFactory();
        }
开发者ID:cmugford,项目名称:Abstract-Air,代码行数:13,代码来源:InMemoryDatabaseTestFixtureBase.cs

示例5: Packet

        public Packet(CarnetNumber number, State state, DateTime date, Association association, DeliveryMode deliveryMode, Invoice invoice, DeliveryNote deliveryNote, User user, string comments, string reference, PacketType type, Clause31Insurer c31Insurer, IEnumerable<Carnet> carnets)
            : base(number)
        {
            Carnets = new List<Carnet>(Contract.Required(carnets, "carnets"));

            this.State = state;
            this.Date = date;
            this.Association = association;
            this.DeliveryMode = deliveryMode;
            this.Invoice = invoice;
            this.User = user;
            this.Comments = comments;
            this.Reference = reference;
            this.Type = type;
            this.Clause31Insurer = c31Insurer;

            carnets.Apply(carnet => carnet.Packet = this);
        }
开发者ID:mriceberg,项目名称:ScriptLib,代码行数:18,代码来源:Packet.cs

示例6: ZippAsync

        public async Task<bool> ZippAsync(IEnumerable<string> iText, string iFileName, string iPassword)
        {
            CheckArguments(iText, iFileName);

            SevenZipCompressor sevenZipCompressor = new SevenZipCompressor()
            {
                DirectoryStructure = true,
                EncryptHeaders = true,
                DefaultItemName = "Default.txt"
            };

            try
            {
                using (var instream = new MemoryStream())
                {
                    using (var streamwriter = new StreamWriter(instream))
                    {
                        iText.Apply(t => streamwriter.WriteLine(t));

                        await streamwriter.FlushAsync();
                        instream.Position = 0;

                        using (Stream outstream = File.Create(iFileName))
                        {
                            await sevenZipCompressor.CompressStreamAnsync(instream, outstream, iPassword);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Trace.WriteLine(string.Format("Problem zipping a text: {0}", e));
                return false;
            }

            return true;
        }
开发者ID:David-Desmaisons,项目名称:MusicCollection,代码行数:37,代码来源:SevenZipZipper.cs

示例7: _purgeChildrenFromRegistry

        private void _purgeChildrenFromRegistry(IDictionary<long, IReactComponent> registry, IEnumerable<IReactComponent> children)
        {
            if (children == null)
            {
                return;
            }

            children.Apply(child =>
            {
                Debug.Assert(!child.IsReactRootView(), "Root views should not be unregistered");

                registry[child.ReactTag.Value] = null;
            });
        }
开发者ID:joemcbride,项目名称:react-native-wpf,代码行数:14,代码来源:UIManager.cs

示例8: CollectFields

        private Dictionary<string, IEnumerable<Field>> CollectFields( ExecutionContext context, GraphType type, IEnumerable<Selection> selections, Dictionary<string, IEnumerable<Field>> fields )
        {
            if( fields == null )
            {
                fields = new Dictionary<string, IEnumerable<Field>>();
            }

            selections.Apply( selection =>
            {
                if( selection.Field != null )
                {
                    if( !ShouldIncludeNode( context, selection.Field.Directives ) )
                    {
                        return;
                    }

                    string name = selection.Field.Alias ?? selection.Field.Name;
                    if( !fields.ContainsKey( name ) )
                    {
                        fields[name] = Enumerable.Empty<Field>();
                    }
                    fields[name] = fields[name].Append( selection.Field );
                }
                else if( selection.Fragment != null )
                {
                    FragmentSpread fragmentSpread = selection.Fragment as FragmentSpread;
                    if( fragmentSpread != null )
                    {
                        if( !ShouldIncludeNode( context, fragmentSpread.Directives ) )
                        {
                            return;
                        }

                        FragmentDefinition fragment = context.Fragments.FindFragmentDefinition( fragmentSpread.Name );
                        if( !ShouldIncludeNode( context, fragment.Directives )
                            || !DoesFragmentConditionMatch( context, fragment, type ) )
                        {
                            return;
                        }

                        CollectFields( context, type, fragment.Selections, fields );
                    }

                    InlineFragment inlineFragment = selection.Fragment as InlineFragment;
                    if( inlineFragment != null )
                    {
                        if( !ShouldIncludeNode( context, inlineFragment.Directives )
                          || !DoesFragmentConditionMatch( context, inlineFragment, type ) )
                        {
                            return;
                        }

                        CollectFields( context, type, inlineFragment.Selections, fields );
                    }
                }
            } );

            return fields;
        }
开发者ID:husterk,项目名称:graphql-dotnet,代码行数:59,代码来源:DocumentExecuter.cs

示例9: AddAlbum

 private void AddAlbum(IEnumerable<IAlbum> Al)
 {
     Al.Apply(al => _PlayList.AddAlbum(al));
 }
开发者ID:David-Desmaisons,项目名称:MusicCollection,代码行数:4,代码来源:PlayerViewModel.cs

示例10: Add

 /// <summary>Adds the given types to this profile.</summary>
 /// <param name="types">The collection of types to add to this profile.</param>
 public void Add(IEnumerable<Type> types) {
    types.Apply(type => Add(type));
 }
开发者ID:borkaborka,项目名称:gmit,代码行数:5,代码来源:BplProfile.cs

示例11: UpdateBindings

        private void UpdateBindings(IEnumerable<IAction> actions)
        {
            if (Execute.InDesignMode)
            {
                return;
            }

            var parentWindow = this.GetWindow();
            if (parentWindow == null)
            {
                Logger.Instance.Warn("WindowKeyBinding defined with no window in the visual hierachy.");
                return;
            }

            var currentBindings = parentWindow.InputBindings;

            if (_bindings != null)
            {
                _bindings.Apply(b => currentBindings.Remove(b.KeyBinding));
            }

            if (actions != null)
            {
                //We don't want to create new ones every time this is iterated over.
                _bindings = ActionKeyBinding.From(actions).ToList();
                _bindings.Apply(a => currentBindings.Add(a.KeyBinding));
            }
            else
            {
                _bindings = null;
            }
        }
开发者ID:Geminior,项目名称:DeepConfig,代码行数:32,代码来源:WindowKeyBinding.cs

示例12: ComplexSubpath

 public ComplexSubpath(IEnumerable<Vector2> vectors)
 {
     vectors.Apply(i => _vectors.Add(i));
 }
开发者ID:freethenation,项目名称:OpenGL-Canvas,代码行数:4,代码来源:ComplexSubpath.cs

示例13: InitWithProfiles

        public void InitWithProfiles(
			IEnumerable<Profile> profiles,
			IServiceLocator services,
			AppSettings settings,
			IProfileLoader profileLoader,
			IAppSettingsLoader appSettingsLoader,
			Action complete)
        {
            _services = services;
            _appSettings = settings;
            _profileLoader = profileLoader;
            _appSettingsLoader = appSettingsLoader;
            _complete = complete;

            Profiles.Content.As<NSMutableArray>().RemoveAllObjects();

            int idx = -1;
            profiles.Apply((p, i) => {
                if(string.Equals(settings.Profile, p.Name)){
                    idx = i;
                }
                Profiles.AddObject(ProfileInfo.For(p));
            });

            Profiles.SelectionIndex = idx;
        }
开发者ID:joemcbride,项目名称:outlander,代码行数:26,代码来源:ProfileSelectorController.cs

示例14: Transform

        private IEnumerable<Tag> Transform(IEnumerable<Tag> tags)
        {
            var newTags = new List<Tag>();
            tags.Apply(tag => {
                _tagTransformers.Apply(t =>
                    {
                        if(t.Matches(tag)) tag = t.Transform(tag);
                    });
                newTags.Add(tag);
            });

            return newTags;
        }
开发者ID:joemcbride,项目名称:outlander,代码行数:13,代码来源:NewGameParser.cs

示例15: _removeChildrenFromContainer

        private void _removeChildrenFromContainer(IReactContainerComponent container, IEnumerable<IReactComponent> children)
        {
            if (children == null)
            {
                return;
            }

            children.Apply(container.RemoveView);
        }
开发者ID:joemcbride,项目名称:react-native-wpf,代码行数:9,代码来源:UIManager.cs


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