public static MethodInfo[] GetMethods(this Type type, BindingFlags flags)
    {
        Type baseType;
        List <MethodInfo> infos = new List <MethodInfo>();
        bool flag = false;

        while (type != null)
        {
            foreach (MethodInfo runtimeMethod in type.GetRuntimeMethods())
            {
                if (!WindowsRuntimeExtension.MatchBindingFlags(runtimeMethod.IsPublic, runtimeMethod.IsPrivate, runtimeMethod.IsStatic, flags, flag))
                {
                    continue;
                }
                infos.Add(runtimeMethod);
            }
            if ((flags & BindingFlags.DeclaredOnly) == BindingFlags.Default)
            {
                baseType = type.GetTypeInfo().BaseType;
            }
            else
            {
                baseType = null;
            }
            type = baseType;
            flag = true;
        }
        return(infos.ToArray());
    }
    public static FieldInfo[] GetFields(this Type type, BindingFlags bindingFlags)
    {
        Type             baseType;
        List <FieldInfo> fieldInfos = new List <FieldInfo>();
        Boolean          flag       = false;

        while (type != null)
        {
            foreach (FieldInfo runtimeField in type.GetRuntimeFields())
            {
                if (!WindowsRuntimeExtension.MatchBindingFlags(runtimeField.IsPublic, runtimeField.IsPrivate, runtimeField.IsStatic, bindingFlags, flag))
                {
                    continue;
                }
                fieldInfos.Add(runtimeField);
            }
            if ((bindingFlags & BindingFlags.DeclaredOnly) == BindingFlags.Default)
            {
                baseType = type.GetTypeInfo().BaseType;
            }
            else
            {
                baseType = null;
            }
            type = baseType;
            flag = true;
        }
        return(fieldInfos.ToArray());
    }
    public static PropertyInfo[] GetProperties(this Type type, BindingFlags bindingFlags)
    {
        Type baseType;
        List <PropertyInfo> propertyInfos = new List <PropertyInfo>();
        bool flag = false;

        while (type != null)
        {
            foreach (PropertyInfo runtimeProperty in type.GetRuntimeProperties())
            {
                MethodInfo getMethod = runtimeProperty.GetMethod ?? runtimeProperty.SetMethod;
                if (!WindowsRuntimeExtension.MatchBindingFlags(getMethod.IsPublic, getMethod.IsPrivate, getMethod.IsStatic, bindingFlags, flag))
                {
                    continue;
                }
                propertyInfos.Add(runtimeProperty);
            }
            if ((bindingFlags & BindingFlags.DeclaredOnly) == BindingFlags.Default)
            {
                baseType = type.GetTypeInfo().BaseType;
            }
            else
            {
                baseType = null;
            }
            type = baseType;
            flag = true;
        }
        return(propertyInfos.ToArray());
    }
    public static ConstructorInfo GetConstructor(this Type type, Type[] args)
    {
        ConstructorInfo constructorInfo;

        using (IEnumerator <ConstructorInfo> enumerator = type.GetTypeInfo().DeclaredConstructors.GetEnumerator())
        {
            while (enumerator.MoveNext())
            {
                ConstructorInfo current = enumerator.Current;
                if (!WindowsRuntimeExtension.ParametersMatch(current.GetParameters(), args))
                {
                    continue;
                }
                constructorInfo = current;
                return(constructorInfo);
            }
            return(null);
        }
    }