src/Shared/EntityFramework/Core/Metadata/Edm/MemberCollection.cs
// <summary>
// Find the index of an item
// </summary>
// <param name="item"> The item whose index is to be looked for </param>
// <returns> The index of the found item, -1 if not found </returns>
Find the index of an item
Find the index of an item
public override int IndexOf(EdmMember item)
        {
            var relativeIndex = base.IndexOf(item);
            if (relativeIndex != -1)
            {
                return relativeIndex + GetBaseTypeMemberCount();
            }
            var baseType = _declaringType.BaseType as StructuralType;
            if (baseType != null)
            {
                return baseType.Members.IndexOf(item);
            }
            return -1;
        }
public override int IndexOf ( EdmMember item ) { var relativeIndex = base . IndexOf ( item ) ; if ( relativeIndex != - 1 ) { return relativeIndex + GetBaseTypeMemberCount ( ) ; } var baseType = _declaringType . BaseType as StructuralType ; if ( baseType != null ) { return baseType . Members . IndexOf ( item ) ; } return - 1 ; }
Find the index of an item
Find the index of an item
// Try to get it from this collection, if found, then the relative index needs to be added with the number // of members in the base type to get the absolute index // Try to find it in the base type
The index of the found item, -1 if not found
The index of the found item - 1 if not found
item
EdmMember
The item whose index is to be looked for
The item whose index is to be looked for