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


C# HashSet.UnionWith方法代码示例

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


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

示例1: GenerateCode

        public static System.Reflection.Assembly GenerateCode(ITextTemplatingEngineHost host, ParsedTemplate pt, 
		                                                       TemplateSettings settings, CodeCompileUnit ccu)
        {
            CompilerParameters pars = new CompilerParameters ();
            pars.GenerateExecutable = false;

            if (settings.Debug) {
                pars.GenerateInMemory = false;
                pars.IncludeDebugInformation = true;
                pars.TempFiles.KeepFiles = true;
            } else {
                pars.GenerateInMemory = true;
                pars.IncludeDebugInformation = false;
            }

            //resolve and add assembly references
            HashSet<string> assemblies = new HashSet<string> ();
            assemblies.UnionWith (settings.Assemblies);
            assemblies.UnionWith (host.StandardAssemblyReferences);
            foreach (string assem in assemblies) {
                string resolvedAssem = host.ResolveAssemblyReference (assem);
                if (!String.IsNullOrEmpty (resolvedAssem)) {
                    pars.ReferencedAssemblies.Add (resolvedAssem);
                } else {
                    pt.LogError ("Could not resolve assembly reference '" + assem + "'");
                    return null;
                }
            }
            CompilerResults results = settings.Provider.CompileAssemblyFromDom (pars, ccu);
            pt.Errors.AddRange (results.Errors);
            if (pt.Errors.HasErrors)
                return null;
            return results.CompiledAssembly;
        }
开发者ID:ferrislucas,项目名称:StatefulT4Processor,代码行数:34,代码来源:TemplatingEngine.cs

示例2: Main

    static void Main()
    {
        InitializeWordsByChar();

        int textLinesCount = int.Parse(Console.ReadLine().ToLower());
        for (int i = 0; i < textLinesCount; i++)
        {
            GetWords(Console.ReadLine().ToLower());
        }

        int wordsCount = int.Parse(Console.ReadLine());
        for (int i = 0; i < wordsCount; i++)
        {
            string word = Console.ReadLine();
            string wordLowerCase = word.ToLower();
            HashSet<string> currentWords = new HashSet<string>();
            currentWords.UnionWith(wordsByChar[wordLowerCase[0]]);
            for (int j = 1; j < wordLowerCase.Length; j++)
            {
                currentWords.IntersectWith(wordsByChar[wordLowerCase[j]]);
            }

            Console.WriteLine("{0} -> {1}", word, currentWords.Count);
        }
    }
开发者ID:vladislav-karamfilov,项目名称:TelerikAcademy,代码行数:25,代码来源:Words.cs

示例3: GatherParallelMembers

        /// <summary>
        /// Gather member which provide continuity with the specified member
        /// </summary>
        /// <param name="Member"></param>
        /// <returns></returns>
        public static IEnumerable<Member> GatherParallelMembers(Member Member, Node LastNode = null, bool MoveDownstream = false)
        {
            Node currentNode;
            Member nextMember;
            IEnumerable<Member> connectedParallelMembers;
            HashSet<Member> parallelMembers;

            parallelMembers = new HashSet<Member>();
            if (MoveDownstream)
                parallelMembers.Add(Member);

            // Determine which will be the next node
            currentNode = MemberHelpers.DetermineNextNode(Member, LastNode, MoveDownstream);

            connectedParallelMembers = currentNode.ConnectedBeams.Select(b => b.Member).Where(m => m != null && m != Member && m.DetermineMemberRelation(Member) == MEMBERRELATION.PARALLEL);
            if (connectedParallelMembers.Any())
            {
                nextMember = connectedParallelMembers.First();
                parallelMembers.UnionWith(GatherParallelMembers(nextMember, currentNode, MoveDownstream));
            }
            else
            {
                if (!MoveDownstream)
                    parallelMembers.UnionWith(GatherParallelMembers(Member, currentNode, true));
            }

            return parallelMembers;
        }
开发者ID:yuominae,项目名称:STAADModel,代码行数:33,代码来源:MemberHelpers.cs

示例4: GetNodes

 public ISet<int> GetNodes()
 {
     var retVal = new HashSet<int>();
     retVal.UnionWith(playerZeroNodes);
     retVal.UnionWith(playerOneNodes);
     return retVal;
 }
开发者ID:AutomataTutor,项目名称:automatatutor-backend,代码行数:7,代码来源:Arena.cs

示例5: GetUserAssemblies

 private HashSet<string> GetUserAssemblies(string managedDir)
 {
   HashSet<string> stringSet = new HashSet<string>();
   stringSet.UnionWith(this.FilterUserAssemblies((IEnumerable<string>) this.m_RuntimeClassRegistry.GetUserAssemblies(), new Predicate<string>(this.m_RuntimeClassRegistry.IsDLLUsed), managedDir));
   stringSet.UnionWith(this.FilterUserAssemblies((IEnumerable<string>) Directory.GetFiles(managedDir, "I18N*.dll", SearchOption.TopDirectoryOnly), (Predicate<string>) (assembly => true), managedDir));
   return stringSet;
 }
开发者ID:BlakeTriana,项目名称:unity-decompiled,代码行数:7,代码来源:IL2CPPBuilder.cs

示例6: AssignmentStatementParser

 static AssignmentStatementParser()
 {
     COLON_EQUALS_SET = new HashSet<TokenType>();
     COLON_EQUALS_SET.Add(TokenType.COLON_EQUALS);
     COLON_EQUALS_SET.UnionWith(ExpressionParser.EXPR_START_SET);
     COLON_EQUALS_SET.UnionWith(StatementParser.STMT_FOLLOW_SET);
 }
开发者ID:jstark,项目名称:dradis,代码行数:7,代码来源:AssignmentStatementParser.cs

示例7: GatherParallelBeams

        /// <summary>
        /// Gather beams which provide continuity with the specified beam
        /// </summary>
        /// <param name="Beam">The start beam around which to contruct the chain</param>
        /// <returns></returns>
        public static IEnumerable<Beam> GatherParallelBeams(Beam Beam, Node LastNode = null, bool MoveDownstream = false)
        {
            Node currentNode;
            Beam nextBeam;
            IEnumerable<Beam> connectedParallelBeams;
            HashSet<Beam> parallelBeams;

            parallelBeams = new HashSet<Beam>();
            if (MoveDownstream)
                parallelBeams.Add(Beam);

            // Determine which will be the next node depending on the beam orientation and direction of travel
            currentNode = BeamHelpers.DetermineNextNode(Beam, LastNode, MoveDownstream);

            // Check if the are any parallel beams among the connected beams and start gathering the beams depending on the direction of travel
            connectedParallelBeams = currentNode.ConnectedBeams.Where(b => b != null && b != Beam && b.DetermineBeamRelationship(Beam) == BEAMRELATION.PARALLEL);
            if (connectedParallelBeams.Any())
            {
                nextBeam = connectedParallelBeams.First();
                parallelBeams.UnionWith(GatherParallelBeams(nextBeam, currentNode, MoveDownstream));
            }
            else
            {
                if (!MoveDownstream)
                    parallelBeams.UnionWith(GatherParallelBeams(Beam, currentNode, true));
            }

            return parallelBeams;
        }
开发者ID:yuominae,项目名称:STAADModel,代码行数:34,代码来源:BeamHelpers.cs

示例8: GetControllerTypes

        public ICollection<Type> GetControllerTypes(string controllerName, HashSet<string> namespaces) {
            HashSet<Type> matchingTypes = new HashSet<Type>();

            ILookup<string, Type> nsLookup;
            if (_cache.TryGetValue(controllerName, out nsLookup)) {
                // this friendly name was located in the cache, now cycle through namespaces
                if (namespaces != null) {
                    foreach (string requestedNamespace in namespaces) {
                        foreach (var targetNamespaceGrouping in nsLookup) {
                            if (IsNamespaceMatch(requestedNamespace, targetNamespaceGrouping.Key)) {
                                matchingTypes.UnionWith(targetNamespaceGrouping);
                            }
                        }
                    }
                }
                else {
                    // if the namespaces parameter is null, search *every* namespace
                    foreach (var nsGroup in nsLookup) {
                        matchingTypes.UnionWith(nsGroup);
                    }
                }
            }

            return matchingTypes;
        }
开发者ID:adrianvallejo,项目名称:MVC3_Source,代码行数:25,代码来源:ControllerTypeCache.cs

示例9: iu_cs_sinalling_relation_delegate_imsi

        public static HashSet<string> iu_cs_sinalling_relation_delegate_imsi(List<streamMessagePool._stream_message> ml, string imsi, bool sFlag)
        {

            //哈希表收集关联因子
            HashSet<string> hs = new HashSet<string>();
            hs.Add(imsi);

            //lr关联收集sccp连接串slr
            IEnumerable<string> l_slr_opc =
                    from n in ml
                    where n.message_gsm_a_imsi == imsi & n.message_sccp_slr != null
                    select n.message_sccp_slr + n.message_source
                        into m
                        where m.Contains("0x")
                        select m;
            hs.UnionWith(l_slr_opc);
            if (l_slr_opc.Any())
                foreach (string slr_opc in l_slr_opc)
                    hs.UnionWith(iu_cs_sinalling_relation_delegate_lr(ml, slr_opc, sFlag));

            //lr关联收集sccp连接串dlr
            IEnumerable<string> l_dlr_dpc =
                    from n in ml
                    where n.message_gsm_a_imsi == imsi & n.message_sccp_dlr != null
                    select n.message_sccp_dlr + n.message_destination
                        into m
                        where m.Contains("0x")
                        select m;
            hs.UnionWith(l_dlr_dpc);
            if (l_dlr_dpc.Any())
                foreach (string dlr_dpc in l_dlr_dpc)
                    hs.UnionWith(iu_cs_sinalling_relation_delegate_lr(ml, dlr_dpc, sFlag));

            return hs;
        }
开发者ID:sushantnitk,项目名称:wiresharkplugin,代码行数:35,代码来源:messageFlowSearch.cs

示例10: getKeysHandled

 public HashSet<KeyCode> getKeysHandled()
 {
     HashSet<KeyCode> keyCodes = new HashSet<KeyCode>();
     keyCodes.UnionWith(getKeyDownHandlers().Keys);
     keyCodes.UnionWith(getKeyUpHandlers().Keys);
     keyCodes.UnionWith(getKeyHandlers().Keys);
     return keyCodes;
 }
开发者ID:knexer,项目名称:VNReduxMiningPrototype,代码行数:8,代码来源:ControlScheme.cs

示例11: Context

 /// <summary>List of cell ids for cells in the same context as the provided cell.</summary>
 /// <remarks>The "context" is the union of the Row, Column, and Shape for the provided cell.</remarks>
 /// <param name="cell">The cell id to find others in the same context.</param>
 /// <returns>The cell ids of all other cells in the same context.</returns>
 public virtual IEnumerable<int> Context(int cell)
 {
     HashSet<Cell> cells = new HashSet<Cell>();
     cells.UnionWith(GetRowRegionForCell(cell).Cells);
     cells.UnionWith(GetColumnRegionForCell(cell).Cells);
     cells.UnionWith(GetShapeRegionForCell(cell).Cells);
     return EnumerateIds(cells, cell);
 }
开发者ID:AlexMaskovyak,项目名称:rit-4005-714-maskovyak-pecoraro,代码行数:12,代码来源:Board.cs

示例12: getAllEdges

 public HashSet<Node> getAllEdges()
 {
     HashSet<Node> allEdges = new HashSet<Node>();
     allEdges.UnionWith(_taxiEdges);
     allEdges.UnionWith(_busEdges);
     allEdges.UnionWith(_ugEdges);
     return allEdges;
 }
开发者ID:GoogleJump,项目名称:ZeroG,代码行数:8,代码来源:Node.cs

示例13: CodeGen

        public async Task<CodeGenResult> CodeGen(Workspace workspace, Project project)
        {
            CompilationUnitSyntax cu = SF.CompilationUnit();

            var usings = new HashSet<string>();
            bool copyUsings = false;

            foreach (Document document in project.Documents)
            {
                SyntaxTree syntaxTree = await document.GetSyntaxTreeAsync();
                _semanticModel = await document.GetSemanticModelAsync();

                IEnumerable<ClassDeclarationSyntax> classes =
                    syntaxTree.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>();

                foreach (var classNode in classes)
                {
                    if (!RoslynUtils.IsPublic(classNode)) continue;

                    ITypeSymbol swmrInterface = FindSwmrInterface(classNode);
                    if (swmrInterface == null)
                    {
                        continue;
                    }

                    var namespaceNode = classNode.Parent as NamespaceDeclarationSyntax;
                    if (namespaceNode == null)
                    {
                        throw new Exception("A grain must be declared inside a namespace");
                    }

                    usings.UnionWith(syntaxTree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().Select(usingDirective => usingDirective.Name.ToString()));

                    int replicaCount = GetReadReplicaCount(swmrInterface);

                    NamespaceDeclarationSyntax namespaceDclr = SF.NamespaceDeclaration(SF.IdentifierName(namespaceNode.Name.ToString())).WithUsings(namespaceNode.Usings);

                    namespaceDclr = namespaceDclr.AddMembers(
                        GenerateWriteGrain(classNode, swmrInterface, replicaCount),
                        GenerateReadGrain(classNode, swmrInterface, replicaCount),
                        GenerateReadReplicaGrain(classNode, swmrInterface)
                        );

                    usings.UnionWith(namespaceNode.Usings.Select(@using => @using.Name.ToString()));

                    cu = cu.AddMembers(namespaceDclr);

                    // only copy the usings if at least one class was generated
                    copyUsings = true;
                }
            }

            if (copyUsings)
            {
                usings.UnionWith(GetCommonUsings());
            }
            return new CodeGenResult(Formatter.Format(cu, workspace).ToString(), usings);
        }
开发者ID:cdsalmons,项目名称:OrleansTemplates,代码行数:58,代码来源:SwmrGrainsGenerator.cs

示例14: GetRecursiveContents

 /// <summary>
 /// Returns a HashSet of the two pockets and all of their contents.
 /// </summary>
 /// <returns>
 /// a HashSet of the two pockets and all of their contents.
 /// </returns>
 public HashSet<Thing> GetRecursiveContents()
 {
     HashSet<Thing> temp = new HashSet<Thing>();
     temp.Add(leftPocket);
     temp.Add(rightPocket);
     temp.UnionWith( leftPocket.GetRecursiveContents());
     temp.UnionWith(rightPocket.GetRecursiveContents());
     return temp;
 }
开发者ID:julia-ford,项目名称:Game-Engine,代码行数:15,代码来源:PantsWithTwoPockets.cs

示例15: GetVariables

        public HashSet<char> GetVariables()
        {
            HashSet<char> variables = new HashSet<char>();

            variables.UnionWith(baseOfPower.GetVariables());
            variables.UnionWith(exponent.GetVariables());

            return variables;
        }
开发者ID:JacquesLucke,项目名称:EquationSolver,代码行数:9,代码来源:PowerLayer.cs


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