// Token: 0x0600646E RID: 25710 RVA: 0x00154A58 File Offset: 0x00152C58 internal static object CreateInstance(object target) { InterfaceForwardingSupport interfaceForwardingSupport = InterfaceForwardingSupport.None; if (target is IList) { interfaceForwardingSupport |= InterfaceForwardingSupport.IBindableVector; } if (target is IList <!0> ) { interfaceForwardingSupport |= InterfaceForwardingSupport.IVector; } if (target is IBindableVectorView) { interfaceForwardingSupport |= InterfaceForwardingSupport.IBindableVectorView; } if (target is IReadOnlyList <T2> ) { interfaceForwardingSupport |= InterfaceForwardingSupport.IVectorView; } if (target is IEnumerable) { interfaceForwardingSupport |= InterfaceForwardingSupport.IBindableIterableOrIIterable; } return(new ICustomPropertyProviderProxy <T1, T2>(target, interfaceForwardingSupport)); }
// // Creates a new instance of ICustomPropertyProviderProxy<T1, T2> and assign appropriate // flags // internal static object CreateInstance(object target) { InterfaceForwardingSupport supportFlags = InterfaceForwardingSupport.None; // // QI and figure out the right flags // if (target is IList) { supportFlags |= InterfaceForwardingSupport.IBindableVector; } // NOTE: We need to use the directed type here // If we use IVector_Raw<T1> here, it derives from a different IIterable<T> which the runtime // doesn't recognize, and therefore IEnumerable cast won't be able to take advantage of this QI if (target is IList <T1> ) { supportFlags |= InterfaceForwardingSupport.IVector; } if (target is IBindableVectorView) { supportFlags |= InterfaceForwardingSupport.IBindableVectorView; } // NOTE: We need to use the redirected type here // If we use IVector_Raw<T1> here, it derives from a different IIterable<T> which the runtime // doesn't recognize, and therefore IEnumerable cast won't be able to take advantage of this QI if (target is IReadOnlyList <T2> ) { supportFlags |= InterfaceForwardingSupport.IVectorView; } // Verify IEnumerable last because the first few QIs might succeed and we need // IEnumerable cast to use that cache (instead of having ICustomPropertyProvider to // forward it manually) // For example, if we try to shoot in the dark by trying IVector<IInspectable> and it // succeeded, IEnumerable needs to know that if (target is IEnumerable) { supportFlags |= InterfaceForwardingSupport.IBindableIterableOrIIterable; } return(new ICustomPropertyProviderProxy <T1, T2>(target, supportFlags)); }
internal ICustomPropertyProviderProxy(object target, InterfaceForwardingSupport flags) { _target = target; _flags = flags; }