internal int InternalIndexOf(string tableName)
{
int cachedI = -1;
if ((null != tableName) && (0 < tableName.Length))
{
int count = _list.Count;
int result = 0;
for (int i = 0; i < count; i++)
{
DataTable table = (DataTable)_list[i];
result = NamesEqual(table.TableName, tableName, false, _dataSet.Locale);
if (result == 1)
{
// ok, we have found a table with the same name.
// let's see if there are any others with the same name
// if any let's return (-3) otherwise...
for (int j = i + 1; j < count; j++)
{
DataTable dupTable = (DataTable)_list[j];
if (NamesEqual(dupTable.TableName, tableName, false, _dataSet.Locale) == 1)
return -3;
}
//... let's just return i
return i;
}
if (result == -1)
cachedI = (cachedI == -1) ? i : -2;
}
}
return cachedI;
}