System.Windows.Forms.ListView.SelectedIndexCollection.InsertIndex C# (CSharp) Method

InsertIndex() private method

private InsertIndex ( int index ) : void
index int
return void
			internal void InsertIndex (int index)
			{
				int iMin = 0;
				int iMax = List.Count - 1;
				while (iMin <= iMax) {
					int iMid = (iMin + iMax) / 2;
					int current_index = (int) List [iMid];

					if (current_index == index)
						return; // Already added
					if (current_index > index)
						iMax = iMid - 1;
					else
						iMin = iMid + 1;
				}

				List.Insert (iMin, index);
			}