System.Windows.Forms.ListBindingHelper.IsListBasedType C# (CSharp) Method

IsListBasedType() private static method

private static IsListBasedType ( Type type ) : bool
type Type
return bool
        private static bool IsListBasedType(Type type)
        {
            // check for IList, ITypedList, IListSource
            if (typeof(IList).IsAssignableFrom(type) ||
                typeof(ITypedList).IsAssignableFrom(type) ||
                typeof(IListSource).IsAssignableFrom(type)) {
                return true;
            }

            // check for IList<>:
            if (type.IsGenericType && !type.IsGenericTypeDefinition) {
                if (typeof(IList<>).IsAssignableFrom(type.GetGenericTypeDefinition())) {
                    return true;
                }
            }

            // check for SomeObject<T> : IList<T> / SomeObject : IList<(SpecificListObjectType)>
            foreach (Type curInterface in type.GetInterfaces()) {
                if (curInterface.IsGenericType) {
                    if (typeof(IList<>).IsAssignableFrom(curInterface.GetGenericTypeDefinition())) {
                        return true;
                    }
                }
            }

            return false;
        }