internal static string[] MapColumnNames(DataColumnMappingCollection mappingCollection, string[] names, MappingDirection direction)
{
if ((mappingCollection == null) || (names == null))
{
return new string[0];
}
ArrayList list = new ArrayList();
foreach (string str2 in names)
{
string sourceColumn;
try
{
if (direction == MappingDirection.DataSetToSource)
{
sourceColumn = mappingCollection.GetByDataSetColumn(str2).SourceColumn;
}
else
{
DataColumnMapping mapping = mappingCollection[str2];
sourceColumn = mapping.DataSetColumn;
}
}
catch (IndexOutOfRangeException)
{
sourceColumn = str2;
}
list.Add(sourceColumn);
}
return (string[]) list.ToArray(typeof(string));
}