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


C# List.RemoveAt方法代码示例

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


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

示例1: ClearInvalidObjects

		//Remove invalid objects from the list. Return true if any were removed.
		private bool ClearInvalidObjects(List<IStText> listToSearch, int offset, bool raiseChangeNotification)
		{
			bool didRemoveAny = false;
			for (int i = listToSearch.Count - 1; i >= 0; i--)
			{
				if (!listToSearch[i].IsValidObject || listToSearch[i].OwnerOfClass(ScrDraftTags.kClassId) != null)
				{
					// Enhance JohnT: if several are removed, especially close together, we might want
					// to combine the change notifications. However I think this will be quite unusual.
					if (m_interestingTests != null)
						m_interestingTests.Remove(listToSearch[i]);
					listToSearch.RemoveAt(i);
					if (raiseChangeNotification)
						RaiseInterestingTextsChanged(i + offset, 0, 1);
					didRemoveAny = true;
				}
			}
			return didRemoveAny;
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:20,代码来源:InterestingTextList.cs

示例2: EnsureRealSegmentsForNonTrivialAnalyses

		protected virtual void EnsureRealSegmentsForNonTrivialAnalyses(List<int> segments, int[] segmentsArray, int iseg, List<int> formsInSegment)
		{
			if (m_cache.IsDummyObject(segmentsArray[iseg]) && HasNonTrivialAnalysis(formsInSegment))
			{
				using (SuppressSubTasks supressActionHandler = new SuppressSubTasks(Cache, true))
				{
					// replace the dummy segment with a real one.
					segmentsArray[iseg] = CmBaseAnnotation.ConvertBaseAnnotationToReal(Cache, segmentsArray[iseg]).Hvo;
					segments.RemoveAt(iseg);
					segments.Insert(iseg, segmentsArray[iseg]);
				}
			}
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:13,代码来源:ITextUtils.cs

示例3: RemoveInvalidCharacters

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Removes the invalid characters.
		/// </summary>
		/// <param name="list">The list.</param>
		/// ------------------------------------------------------------------------------------
		private void RemoveInvalidCharacters(List<TextTokenSubstring> list)
		{
			// Getting one cpe and properly disposing it instead of creating a new cpe for every
			// character in the Bible solves TE-8420, plus it is many, many times faster.
			for (int i = list.Count - 1; i >= 0; i--)
			{
				if (!TsStringUtils.IsValidChar(list[i].InventoryText, m_chrPropEng))
					list.RemoveAt(i);
			}
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:16,代码来源:ValidCharactersDlg.cs

示例4: ReplaceListItem

		/// <summary>
		/// Replace SortObjects corresponding to hvoToReplace with new SortObjects for newObj.
		/// </summary>
		/// <param name="newObj"></param>
		/// <param name="hvoToReplace"></param>
		/// <param name="fAssumeSame">if true, we'll try to replace sort objects for hvoToReplace with newObj at the same indices.
		/// if false, we'll rely upon sorter to merge the new item into the right index, or else add to the end.
		/// Enhance: Is there some way we can compare the sort/filter results for newObj and hvoToReplace that is hvo indepedendent?</param>
		/// <returns>resulting list of newSortItems added to SortedObjects</returns>
		protected ArrayList ReplaceListItem(ICmObject newObj, int hvoToReplace, bool fAssumeSame)
		{
			ArrayList newSortItems = new ArrayList();
			// Note: don't check NeedToReloadVirtualProperty here, so we can update the list, even if we need to
			// reload it at a later time. This allows joining/breaking wordforms in the Concordance tools, without
			// necessarily having to reload the entire list. Typically replacements will be with real ids, and those
			// should be stable to add in the new view.
			//if (NeedToReloadVirtualProperty)
			//    return newSortItems;	// we don't need to update the list, if we're planning to reload the whole thing.
			List<int> indicesOfSortItemsToRemove = new List<int>(IndicesOfSortItems(new List<int>(new int[] { hvoToReplace })));
			ArrayList remainingInsertItems = new ArrayList();
			int hvoNewObject = 0;
			if (newObj != null)
			{
				hvoNewObject = newObj.Hvo;
				// we don't want to add new sort items, if we've already added them, but we do want to allow
				// a replacement.
				if (hvoToReplace == hvoNewObject || IndexOfFirstSortItem(new List<int>(new int[] { hvoNewObject })) < 0)
					MakeItemsFor(newSortItems, newObj);
				remainingInsertItems = (ArrayList)newSortItems.Clone();
				if (fAssumeSame)
				{
					//assume we're converting a dummy item to a real one.
					//In that case, the real item should have same basic content as the dummy item we are replacing,
					//so we can replace the item at the same sortItem indices.
					foreach (object itemToInsert in newSortItems)
					{
						if (indicesOfSortItemsToRemove.Count > 0)
						{
							int iToReplace = indicesOfSortItemsToRemove[0];
							SortedObjects.RemoveAt(iToReplace);
							SortedObjects.Insert(iToReplace, itemToInsert);
							indicesOfSortItemsToRemove.RemoveAt(0);
							remainingInsertItems.RemoveAt(0);
						}
						else
						{
							break;
						}
					}
				}
			}
			// Although, ideally, during a dummy conversion there should be a one-to-one correspondence between
			// the sort items found for the dummy object, and the sort items generated for its real object,
			// it's possible that at the time we added the dummy item to the record sort list, it didn't
			// have the same properties matching a filter or sorter as the real item. Try to do the best we
			// can by removing remaining sort items for the dummy object and then adding any additional sort items
			// for the real object.

			// remove the remaining items.
			indicesOfSortItemsToRemove.Sort();
			indicesOfSortItemsToRemove.Reverse();
			foreach (int iToRemove in indicesOfSortItemsToRemove)
			{
				SortedObjects.RemoveAt(iToRemove);
			}
			// add the remaining items.
			if (m_sorter != null)
			{
				m_sorter.MergeInto(SortedObjects, remainingInsertItems);
			}
			else
			{
				// Add at the end.
				SortedObjects.AddRange(remainingInsertItems);
			}

			// update our current selected hvo, if necessary
			if (m_hvoCurrent == hvoToReplace)
				m_hvoCurrent = hvoNewObject;
			return newSortItems;
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:81,代码来源:RecordList.cs


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