public object this[string columnName]
{
get
{
object o = null;
if (TryGetValue(columnName, out o))
{
return o;
}
else return null;
}
set
{
if (currentValues == null && ordinals == null)
{
if (onFirstAccess != null)
{
onFirstAccess(this);
}
}
if (ordinals.ContainsKey(columnName))
{
int ordinal = ordinals[columnName];
// Maybe we're in a collection and this slot isn't in our
// object[] currentValues
if (ordinal >= currentValues.Length)
{
Reallocate();
}
// Set the value
currentValues[ordinals[columnName]] = value;
}
else
{
int ordinal = ordinals.Count;
// Okay, all we know is that this value hasn't been set yet.
ordinals[columnName] = ordinal;
// Maybe we're in a collection and this slot isn't in our
// object[] currentValues
if (ordinal >= currentValues.Length)
{
Reallocate();
}
currentValues[ordinals[columnName]] = value;
}
}
}