Can someone improve this code? I need to eliminate the for
loop.
public bool CheckMobileSim(List<Mobile_Range> numberRange, string MobileNumber)
{
bool SimType = new bool();
string NineDigits = MobileNumber.Substring(0, 9).ToString();
long Number = Convert.ToInt64(NineDigits);
if (numberRange != null)
{
if (numberRange.Count > 0)
{
for (int i = 0; i < numberRange.Count; i++)
{
if ((Number >= numberRange[i].RangeStart && Number < numberRange[i].RangeEnd))
{
SimType = true;
break;
}
}
}
}
return SimType;
}