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


C# Set.AddRange方法代码示例

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


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

示例1: DeleteObjectSideEffects

		/// <summary>
		/// This method is the one to override if you need side effects when DeleteUnderlyingObject
		/// is called. If other objects should be deleted also, do NOT delete them directly; this
		/// tends to produce abysmal performance. Rather, add them to objectsToDeleteAlso, and the
		/// whole lot (including this) will be deleted in one relatively efficient operation.
		/// You should not modify objectsToDeleteAlso except to add HVOs to it.
		/// You must not use the FDO object after calling this, it has been put into the deleted state.
		/// </summary>
		/// <param name="objectsToDeleteAlso">hashtable of HVOs (value typically just true, it's really a set).</param>
		/// <param name="state"></param>
		public override void DeleteObjectSideEffects(Set<int> objectsToDeleteAlso, ProgressState state)
		{
			objectsToDeleteAlso.AddRange(FeatureConstraints);

			base.DeleteObjectSideEffects(objectsToDeleteAlso, state);
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:16,代码来源:LingOverrides.cs

示例2: ReferenceTargetCandidates

		/// <summary>
		/// Get a set of hvos that are suitable for targets to a reference property.
		/// Subclasses should override this method to return a sensible list of IDs.
		/// </summary>
		/// <param name="flid">The reference property that can store the IDs.</param>
		/// <returns>A set of hvos.</returns>
		public override Set<int> ReferenceTargetCandidates(int flid)
		{
			Set<int> set = null;
			switch (flid)
			{
				case (int)PhPhoneme.PhPhonemeTags.kflidFeatures:
					set = new Set<int>();
					set.AddRange(m_cache.LangProject.PhFeatureSystemOA.FeaturesOC.HvoArray);
					break;
				default:
					set = base.ReferenceTargetCandidates(flid);
					break;
			}
			return set;
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:21,代码来源:LingOverrides.cs

示例3: VerifyCacheRules

 /// <summary>
 /// Confirm the set of cache rules in the given execution context includes a set of expected ones; assertion failure if not.
 /// </summary>
 /// <param name="ctx"></param>
 /// <param name="rules"></param>
 void VerifyCacheRules(ExecutionContext ctx, IList rules)
 {
     Set set = new Set();
     foreach (CacheRule rule in ctx.CacheRules)
         set.AddRange(rule.AllLeafRules);
     foreach (CacheRule r in rules)
     {
         Assert.IsTrue(set.Contains(r), "Unable to find expected CacheRule (" + r.Description + ")");
         set.Remove(r);
     }
 }
开发者ID:nuxleus,项目名称:flexwikicore,代码行数:16,代码来源:CachingTests.cs

示例4: GetWritingSystems

		/// <summary>
		/// Return the possible writing systems that we might want to preload for the given fragment.
		/// Note that currently this is for optimization and preloading; it is not (yet) guaranteed to
		/// return EVERY writing system that might be displayed by the given fragment.
		/// </summary>
		/// <param name="frag"></param>
		/// <param name="cache"></param>
		/// <returns></returns>
		public static Set<int> GetWritingSystems(XmlNode frag, FdoCache cache)
		{
			string wsSpec = null;
			XmlAttribute xa = frag.Attributes["ws"];
			if (xa == null)
				return new Set<int>(0);
			wsSpec = GetWsSpecWithoutPrefix(xa.Value);
			Set<int> result = new Set<int>();

			switch (wsSpec)
			{
				case "vernacular":
					result.Add(cache.DefaultVernWs);
					break;
				case "analysis":
					result.Add(cache.DefaultAnalWs);
					break;
				case "pronunciation":
				case "all pronunciation":
					result.Add(cache.LangProject.DefaultPronunciationWritingSystem);
					break;
				case "current":
					break;
				case "reversal":
					// Enhance JohnT: make this (currently for optimization preloading) routine work
					// better for reversal views
					//actualWS = GetReversalIndexEntryWritingSystem(cache, hvoObj, wsDefault);
					break;
				case "best analorvern":
				case "best vernoranal":
					return cache.LangProject.CurrentAnalysisAndVernWss;
				// Enhance JohnT: make this (currently for optimization preloading) routine work
				// better for the above two cases: possibly add all current analysis and vernacular writing systems
				case "analysis vernacular":
				case "av":
				case "vernacular analysis":
				case "va":
					result.Add(cache.DefaultVernWs);
					result.Add(cache.DefaultAnalWs);
					break;
				case "user":
					result.Add(cache.DefaultUserWs);
					break;
				case "best analysis":
				case "all analysis":
					result.AddRange(cache.LangProject.CurAnalysisWssRS.HvoArray);
					break;
				case "best vernacular":
				case "all vernacular":
					result.AddRange(cache.LangProject.CurVernWssRS.HvoArray);
					break;
				default:
					// See if we can get anywhere by treating it as an ICU locale.
					// Note that it is important to do this in a way that won't create a new writing system for
					// an invalid locale name, for example, if 'all analysis' is mistakenly passed to this routine.
					// Note however that the behavior of recognizing an ICU locale name for an existing writing system
					// definitely IS needed, e.g., when the user configures a Browse view to show an explicit writing system.
					int wsT = cache.LanguageWritingSystemFactoryAccessor.GetWsFromStr(wsSpec);
					if (wsT != 0)
						result.Add(wsT);
					break;
			}
			return result;
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:72,代码来源:LangProject.cs

示例5: FindCorrespondingItemsInCurrentList

		private Set<int> FindCorrespondingItemsInCurrentList(IDictionary<int, object> itemAndListSourceTokenPairs, PartOwnershipTree pot)
		{
			// create a reverse index of classes to a list of items
			IDictionary<int, Set<int>> sourceFlidsToItems = MapSourceFlidsToItems(itemAndListSourceTokenPairs);

			Set<int> relativesInCurrentList = new Set<int>();
			foreach (KeyValuePair<int, Set<int>> sourceFlidToItems in sourceFlidsToItems)
			{
				Set<int> commonAncestors;
				relativesInCurrentList.AddRange(pot.FindCorrespondingItemsInCurrentList(sourceFlidToItems.Key,
																		 sourceFlidToItems.Value, m_flid,
																		 out commonAncestors));
			}
			return relativesInCurrentList;
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:15,代码来源:RecordList.cs

示例6: DisableItem

		/// <summary>
		/// kludge: filter to allow only complex entry references.
		/// </summary>
		/// <param name="hvoItem"></param>
		/// <returns></returns>
		protected override bool DisableItem(int hvoItem)
		{
			if (m_complexEntryRefs == null)
			{
				m_complexEntryRefs = new Set<int>();
				Dictionary<int, List<int>> dict = new Dictionary<int,List<int>>();
				LexEntry.LoadAllComplexFormEntryRefs(m_cache, dict);
				// go through each list and add the values to our set.
				foreach (List<int> refs in dict.Values)
					m_complexEntryRefs.AddRange(refs);
			}
			return !m_complexEntryRefs.Contains(hvoItem);
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:18,代码来源:BulkEditBar.cs

示例7: ComputeEffects

        /// <summary>
        /// Given a Set of effects over abstract heap locations,
        /// computes a set of effects over the method parameters
        /// or in the global scope
        /// </summary>
        /// <param name="Effects"></param>
        /// <returns></returns>
        public Set<VariableEffect> ComputeEffects(AbstractEffects Effects)
        {
            Set<VariableEffect> variableEffects = new Set<VariableEffect>();

            // Traverse every write effect
            foreach (AField af in Effects)
              variableEffects.AddRange(EffectsInVariables(af));
            return variableEffects;
        }
开发者ID:tapicer,项目名称:resource-contracts-.net,代码行数:16,代码来源:PurityAnalysis.cs

示例8: GetBestAlt

			private int GetBestAlt(int hvo, int tag, int wsPreferred, int wsDefault, int[] wsList)
			{
				Set<int> wsSet = new Set<int>();
				if (wsPreferred != 0)
					wsSet.Add(wsPreferred);
				wsSet.AddRange(wsList);
				// We're not dealing with a real cache, so can't call something like this:
				//ws = LangProject.InterpretWsLabel(m_caches.MainCache,
				//    LangProject.GetMagicWsNameFromId(ws),
				//    m_caches.MainCache.DefaultAnalWs,
				//    hvo, spec.StringFlid, null);
				int wsActual = 0;
				foreach (int ws1 in wsSet.ToArray())
				{
					ITsString tssTest = m_caches.DataAccess.get_MultiStringAlt(hvo, tag, ws1);
					if (tssTest != null && tssTest.Length != 0)
					{
						wsActual = ws1;
						break;
					}
				}
				// Enhance JohnT: to be really picky here we should do like the real InterpretWsLabel
				// and fall back to default UI language, then English.
				// But we probably aren't even copying those alternatives to the sandbox cache.
				if (wsActual == 0)
					wsActual = wsDefault;
				return wsActual;
			}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:28,代码来源:SandboxBase.cs

示例9: ItemsToChange

		internal Set<int> ItemsToChange(bool fOnlyIfSelected)
		{
			CheckDisposed();

			Set<int> itemsToChange = new Set<int>();
			if (fOnlyIfSelected)
			{
				itemsToChange.AddRange(m_bv.CheckedItems);
			}
			else
			{
				itemsToChange.AddRange(m_bv.AllItems);
			}

			return itemsToChange;
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:16,代码来源:BulkEditBar.cs

示例10: CheckboxBehavior_SiblingClassesItemsShouldInheritSelectionThroughParent_UnselectAll

		public void CheckboxBehavior_SiblingClassesItemsShouldInheritSelectionThroughParent_UnselectAll()
		{
			// first create an entry with a pronunciation and some senses.
			ILexPronunciation pronunciation;
			ILexEntry parentEntry = CreateZZZparentEntryWithMultipleSensesAndPronunciation(out pronunciation);
			// some entries (like variants) don't have senses, so we need to factor those into our results.
			ICollection<ILexEntry> entriesWithoutSenses = FindEntriesWithoutSenses();

			m_bulkEditBar.SwitchTab("BulkCopy");
			m_bv.ShowColumn("Allomorph");
			m_bulkEditBar.SetTargetField("Glosses");
			RecordClerk clerk = (m_bv.Parent as RecordBrowseViewForTests).Clerk;

			// Unselect All
			m_bv.OnUncheckAll();
			// now switch to allomorphs
			using (FilterBehavior.Create(this))
				m_bulkEditBar.SetTargetField("Allomorphs");
			// validate that everything (except variant allomorph?) is still not selected.
			Set<int> checkedItems = new Set<int>(m_bv.CheckedItems);
			Set<int> selectedEntries = new Set<int>();
			selectedEntries.AddRange(FdoVectorUtils.ConvertCmObjectsToHvos<ILexEntry>(entriesWithoutSenses));
			Assert.AreEqual(selectedEntries.Count, checkedItems.Count);
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:24,代码来源:BulkEditBarTests.cs

示例11: CheckboxBehavior_ParentClassesItemsShouldInheritSelection_Selected

		public void CheckboxBehavior_ParentClassesItemsShouldInheritSelection_Selected()
		{
			// find a lex entry that has multiple senses (i.e. descendents).
			ILexEntry entryWithMultipleDescendents = CreateZZZparentEntryWithMultipleSensesAndPronunciation_AndUpdateList();
			// some entries (like variants) don't have senses, so we need to factor those into our results.
			ICollection<ILexEntry> entriesWithoutSenses = FindEntriesWithoutSenses();

			m_bulkEditBar.SwitchTab("BulkCopy");
			m_bulkEditBar.SetTargetField("Glosses");
			Assert.AreEqual(LexSense.kclsidLexSense, m_bv.ListItemsClass);
			RecordClerk clerk = (m_bv.Parent as RecordBrowseViewForTests).Clerk;

			m_bv.OnUncheckAll();
			// select the sense.
			m_bv.SetCheckedItems(new int[] { entryWithMultipleDescendents.AllSenses[0].Hvo });

			using (FilterBehavior.Create(this))
				m_bulkEditBar.SetTargetField("Lexeme Form");

			Set<int> selectedEntries = new Set<int>(new int[] {entryWithMultipleDescendents.Hvo});
			selectedEntries.AddRange(FdoVectorUtils.ConvertCmObjectsToHvos<ILexEntry>(entriesWithoutSenses));
			Set<int> checkedItems = new Set<int>(m_bv.CheckedItems);
			Assert.AreEqual(selectedEntries.Count, checkedItems.Count, "Checked items mismatched.");
			Assert.IsTrue(checkedItems.Equals(selectedEntries), "Checked items mismatched.");
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:25,代码来源:BulkEditBarTests.cs

示例12: RemoveUnwantedSortItems

		/// <summary>
		/// This will remove the given hvosToRemove (if they exist in our sort items) and any items that refer to invalid objects.
		/// Reload the view if there were any changes, and adjust the CurrentIndex
		/// </summary>
		protected internal void RemoveUnwantedSortItems(List<int> hvosToRemove)
		{
			if (m_sortedObjects == null)
				return;	// nothing to remove.
			bool fUpdatingListOrig = m_fUpdatingList;
			m_fUpdatingList = true;
			try
			{
				int currentIndex = CurrentIndex;
				int cOrigSortObjects = m_sortedObjects.Count;
				// Note: We start with a Set, since it can't have duplicates.
				// First remove the given hvos from our sort items.
				Set<int> unwantedIndices = new Set<int>(IndicesOfSortItems(hvosToRemove));
				// then remove any remaining items that point to invalid objects.
				unwantedIndices.AddRange(IndicesOfInvalidSortItems());
				// Put the now unique indices into a list,
				// so we can make sure they are processed in reverse order.
				List<int> sortedIndices = new List<int>(unwantedIndices.ToArray());
				sortedIndices.Sort();
				sortedIndices.Reverse();
				foreach (int indexOfSortItem in sortedIndices)
				{
					if (indexOfSortItem >= 0)
					{
						m_sortedObjects.RemoveAt(indexOfSortItem);
						if (indexOfSortItem < currentIndex || SortedObjects.Count <= currentIndex)
							currentIndex--;
					}
				}
				if (m_sortedObjects.Count == 0)
					currentIndex = -1;
				else if (currentIndex >= m_sortedObjects.Count)
					currentIndex = m_sortedObjects.Count - 1;
				CurrentIndex = currentIndex;
				if (m_sortedObjects.Count != cOrigSortObjects)
				{
					SendPropChangedOnListChange(CurrentIndex,
						SortedObjects, ListChangedEventArgs.ListChangedActions.Normal);
				}
			}
			finally
			{
				m_fUpdatingList = fUpdatingListOrig;
			}
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:49,代码来源:RecordList.cs

示例13: joinCalledMethod

 private void joinCalledMethod(Dictionary<Label, Set<Method>> cm1, Dictionary<Label, Set<Method>> cm2)
 {
   foreach (Label lb in cm2.Keys)
   {
     Set<Method> mths2 = cm2[lb];
     Set<Method> mths1 = new Set<Method>();
     if (cm1.ContainsKey(lb))
     {
       mths1.AddRange(cm1[lb]);
     }
     mths1.AddRange(mths2);
     cm1[lb] = mths1;
   }
 }
开发者ID:hesam,项目名称:SketchSharp,代码行数:14,代码来源:PointsToAnalysis.cs

示例14: GetAllWritingSystems

		/// <summary>
		/// Get a Set of zero or more actual writing system IDs for the given ws identifier.
		/// </summary>
		/// <param name="sWs">One of our magic strings that signifies one or more writing systems</param>
		/// <param name="cache"></param>
		/// <param name="currentWS"></param>
		/// <param name="hvo">object to use in determining 'best' names</param>
		/// <param name="flid">flid to use in determining 'best' names</param>
		/// <returns></returns>
		public static Set<int> GetAllWritingSystems(string sWs, FdoCache cache, IWritingSystem currentWS, int hvo, int flid)
		{
			Set<int> allWsIds = new Set<int>();
			if (sWs != null)
			{
				switch (sWs)
				{
					case "all analysis":
						allWsIds.AddRange(cache.LangProject.CurAnalysisWssRS.HvoArray);
						break;
					case "all vernacular":
						allWsIds.AddRange(cache.LangProject.CurVernWssRS.HvoArray);
						break;
					case "analysis vernacular":
						allWsIds.AddRange(cache.LangProject.CurAnalysisWssRS.HvoArray);
						allWsIds.AddRange(cache.LangProject.CurVernWssRS.HvoArray);
						break;
					case "vernacular analysis":
						allWsIds.AddRange(cache.LangProject.CurVernWssRS.HvoArray);
						allWsIds.AddRange(cache.LangProject.CurAnalysisWssRS.HvoArray);
						break;
					case "all pronunciation":
						cache.LangProject.InitializePronunciationWritingSystems();
						allWsIds.AddRange(cache.LangProject.CurPronunWssRS.HvoArray);
						//if (allWsIds.Count == 0)
						//	allWsIds.Add(cache.LangProject.DefaultPronunciationWritingSystem);
						break;
					default:
						sWs = GetWsSpecWithoutPrefix(sWs);
						string[] rgsWs = sWs.Split(new char[] { ',' });
						for (int i = 0; i < rgsWs.Length; ++i)
						{
							int ws = InterpretWsLabel(cache, rgsWs[i], 0, hvo, flid, currentWS);
							if (ws != 0)
								allWsIds.Add(ws);
						}
						break;
				}
			}

			return allWsIds;
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:51,代码来源:LangProject.cs

示例15: DeleteProject

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Lets the user delete any FW databases that are not currently open
		/// </summary>
		/// <param name="dialogOwner">The owner of the dialog</param>
		/// <param name="helpTopicProvider">The help topic provider.</param>
		/// ------------------------------------------------------------------------------------
		internal static void DeleteProject(Form dialogOwner, IHelpTopicProvider helpTopicProvider)
		{
			Set<string> projectsInUse = new Set<string>(ProjectsInUseLocally());
			IClientServerServices css = ClientServerServices.Current;
			ILocalClientServerServices local = null;
			if (css != null)
			{
				local = css.Local;
				if (local != null && local.ShareMyProjects)
					projectsInUse.AddRange(local.ListOpenProjects());
			}
			using (FwDeleteProjectDlg dlg = new FwDeleteProjectDlg(projectsInUse))
			{
				dlg.SetDialogProperties(helpTopicProvider);
				dlg.ShowDialog(dialogOwner);
			}
			if (local != null)
				local.RefreshProjectNames();
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:26,代码来源:FieldWorks.cs


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