src/Shared/EntityFramework/Core/Objects/DataRecordObjectView.cs
// <summary>
// Return a <see cref="PropertyInfo" /> instance that represents
// a strongly-typed indexer property on the specified type.
// </summary>
// <param name="type">
// <see cref="Type" /> that may define the appropriate indexer.
// </param>
// <returns>
// <see cref="PropertyInfo" /> instance of indexer defined on supplied type that returns an object of any type but
// <see
//     cref="Object" />
// ; or null if no such indexer is defined on the supplied type.
// </returns>
// <remarks>
// The algorithm here is lifted from System.Windows.Forms.ListBindingHelper,
// from the GetTypedIndexer method.
// The Entity Framework could not take a dependency on WinForms,
// so we lifted the appropriate parts from the WinForms code here.
// Not the best, but much better than guessing as to what algorithm is proper for data binding.
// </remarks>
Return a  instance that represents
a strongly-typed indexer property on the specified type.
Return a instance that represents a strongly - typed indexer property on the specified type .
private static PropertyInfo GetTypedIndexer(Type type)
        {
            PropertyInfo indexer = null;
            if (typeof(IList).IsAssignableFrom(type)
                || typeof(ITypedList).IsAssignableFrom(type)
                || typeof(IListSource).IsAssignableFrom(type))
            {
                var props = type.GetInstanceProperties().Where(p => p.IsPublic());
                foreach (var prop in props)
                {
                    if (prop.GetIndexParameters().Length > 0
                        && prop.PropertyType != typeof(object))
                    {
                        indexer = prop;
                        if (indexer.Name == "Item")
                        {
                            break;
                        }
                    }
                }
            }
            return indexer;
        }
private static PropertyInfo GetTypedIndexer ( Type type ) { PropertyInfo indexer = null ; if ( typeof ( IList ) . IsAssignableFrom ( type ) || typeof ( ITypedList ) . IsAssignableFrom ( type ) || typeof ( IListSource ) . IsAssignableFrom ( type ) ) { var props = type . GetInstanceProperties ( ) . Where ( p => p . IsPublic ( ) ) ; foreach ( var prop in props ) { if ( prop . GetIndexParameters ( ) . Length > 0 && prop . PropertyType != typeof ( object ) ) { indexer = prop ; if ( indexer . Name == " " ) { break ; } } } } return indexer ; }
Return a  instance that represents
a strongly-typed indexer property on the specified type.
Return a instance that represents a strongly - typed indexer property on the specified type .
//Prefer the standard indexer, if there is one
instance of indexer defined on supplied type that returns an object of any type but

; or null if no such indexer is defined on the supplied type.
instance of indexer defined on supplied type that returns an object of any type but ; or null if no such indexer is defined on the supplied type .
type
Type
that may define the appropriate indexer.
that may define the appropriate indexer .
remarks
The algorithm here is lifted from System.Windows.Forms.ListBindingHelper,
from the GetTypedIndexer method.
The Entity Framework could not take a dependency on WinForms,
so we lifted the appropriate parts from the WinForms code here.
Not the best, but much better than guessing as to what algorithm is proper for data binding.
The algorithm here is lifted from System . Windows . Forms . ListBindingHelper from the GetTypedIndexer method . The Entity Framework could not take a dependency on WinForms so we lifted the appropriate parts from the WinForms code here . Not the best but much better than guessing as to what algorithm is proper for data binding .