private GetValueIndexCaseInsensitive ( string name, System.Dynamic.ExpandoObject obj ) : int | ||
name | string | the name of the member |
obj | System.Dynamic.ExpandoObject | The ExpandoObject associated with the class /// that is used to check if a member has been deleted. |
return | int |
private int GetValueIndexCaseInsensitive(string name, ExpandoObject obj)
{
int caseInsensitiveMatch = ExpandoObject.NoMatch; //the location of the case-insensitive matching member
lock (obj.LockObject)
{
for (int i = _keys.Length - 1; i >= 0; i--)
{
if (string.Equals(
_keys[i],
name,
StringComparison.OrdinalIgnoreCase))
{
//if the matching member is deleted, continue searching
if (!obj.IsDeletedMember(i))
{
if (caseInsensitiveMatch == ExpandoObject.NoMatch)
{
caseInsensitiveMatch = i;
}
else
{
//Ambiguous match, stop searching
return ExpandoObject.AmbiguousMatchFound;
}
}
}
}
}
//There is exactly one member with case insensitive match.
return caseInsensitiveMatch;
}