當前位置: 首頁>>代碼示例>>C#>>正文


C# List.BinarySearch方法代碼示例

本文整理匯總了C#中XCore.List.BinarySearch方法的典型用法代碼示例。如果您正苦於以下問題:C# List.BinarySearch方法的具體用法?C# List.BinarySearch怎麽用?C# List.BinarySearch使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在XCore.List的用法示例。


在下文中一共展示了List.BinarySearch方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ModifyOverlay

		public void ModifyOverlay(bool fApplyTag, IVwOverlay pvo, int itag)
		{
			CheckDisposed();
			if (m_rootb == null)
				return;

			Debug.WriteLine("WARNING: RootSite.ModifyOverlay() isn't tested yet");
			int hvo;
			uint clrFore;
			uint clrBack;
			uint clrUnder;
			int unt;
			bool fHidden;
			string uid;
			using (ArrayPtr arrayPtr = MarshalEx.StringToNative((int)VwConst1.kcchGuidRepLength + 1, true))
			{
				pvo.GetDbTagInfo(itag, out hvo, out clrFore, out clrBack, out clrUnder, out unt,
					out fHidden, arrayPtr);
				uid = MarshalEx.NativeToString(arrayPtr,
					(int)VwConst1.kcchGuidRepLength, false);
			}

			IVwSelection vwsel;
			ITsTextProps[] vttp;
			IVwPropertyStore[] vvps;
			if (EditingHelper.GetCharacterProps(out vwsel, out vttp, out vvps))
			{
				int cttp = vttp.Length;
				for (int ittp = 0; ittp < cttp; ittp++)
				{
					string strGuid = vttp[ittp].GetStrPropValue(
						(int)FwTextPropType.ktptTags);

					// REVIEW (EberhardB): I'm not sure if this works
					int cGuids = strGuid.Length / Marshal.SizeOf(typeof(Guid));
					List<string> guids = new List<string>();
					for (int i = 0; i < cGuids; i++)
						guids.Add(strGuid.Substring(i, Marshal.SizeOf(typeof(Guid))));

					if (fApplyTag)
					{
						// Add the tag if it does not exist
						if (guids.BinarySearch(uid) >= 0)
						{
							// The tag has already been applied to the textprop, so it doesn't
							// need to be modified.
							vttp[ittp] = null;
							continue;
						}
						else
						{
							// We need to add the tag to the textprop.
							guids.Add(uid);
							guids.Sort();
						}
					}
					else
					{
						// Remove the tag from the textprop.
						guids.Remove(uid);
					}

					ITsPropsBldr tpb = vttp[ittp].GetBldr();
					tpb.SetStrPropValue((int)FwTextPropType.ktptTags,
						guids.ToString());

					vttp[ittp] = tpb.GetTextProps();
				}
				vwsel.SetSelectionProps(cttp, vttp);

				/*
				 * ENHANCE (EberhardB): Implement this if we need it. It probably should be
				 * implemented in a derived class (view class for DataNotebook?)
				// Update the RnGenericRec_PhraseTags table as necessary.
				// (Yes, this is special case code!)

				AfDbInfo * pdbi = NULL;
				AfMainWnd * pamw = m_pwndSubclass->MainWindow();
				if (pamw)
				{
					AfMdiMainWnd * pammw = dynamic_cast<AfMdiMainWnd *>(pamw);
					AfLpInfo * plpi = NULL;
					if (pammw)
					{
						plpi = pammw->GetLpInfo();
						if (plpi)
							pdbi = plpi->GetDbInfo();
					}
				}
				if (pdbi)
				{
					int clevEnd;
					int clevAnchor;
					HVO hvoEnd;
					HVO hvoAnchor;
					PropTag tagEnd;
					PropTag tagAnchor;
					int ihvo;
					int cpropPrev;
					IVwPropertyStorePtr qvps;
//.........這裏部分代碼省略.........
開發者ID:bbriggs,項目名稱:FieldWorks,代碼行數:101,代碼來源:SimpleRootSite.cs


注:本文中的XCore.List.BinarySearch方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。