Someone
public text v1 · immutable private int FindUserIndex(ChannelUser User)
{
// TODO: URGENT -- FIX THIS
if (Items.Count == 0)
{
return 0;
}
else
{
int Low = 0;
int High = Items.Count - 1;
int InsertPoint = 0;
while (Low < High)
{
InsertPoint = ( Low + ( High - Low ) ) / 2;
int Comp = User.CompareTo(Items[InsertPoint] as ChannelUser);
if (Comp > 0)
{
Low = InsertPoint + 1;
}
else if (Comp < 0)
{
High = InsertPoint - 1;
}
else
{
return InsertPoint;
}
}
return InsertPoint;
}