Exemplo n.º 1
0
        public static IEnumerable <TMember> Select <TMember>(this TypeMember type, Func <TMember, bool> where = null)
            where TMember : AbstractMember
        {
            var selector = type.Members.OfType <TMember>();

            if (where != null)
            {
                selector = selector.Where(where);
            }

            return(selector);
        }
Exemplo n.º 2
0
        public static IEnumerable <TMember> SelectPublicInstance <TMember>(this TypeMember type, Func <TMember, bool> where = null)
            where TMember : AbstractMember
        {
            var selector =
                Select <TMember>(type, where)
                .Where(m =>
                       m.Visibility == MemberVisibility.Public &&
                       (m.Modifier & MemberModifier.Static) == 0
                       );

            return(selector);
        }
Exemplo n.º 3
0
        public bool Equals(TypeMember other)
        {
            if (ReferenceEquals(other, null))
            {
                return(false);
            }

            //TODO: compare by bindings
            //if (this.ClrBinding != null)
            //{
            //    return (this.ClrBinding == other.ClrBinding);
            //}

            return(ReferenceEquals(this, other));
        }
Exemplo n.º 4
0
        public bool IsAssignableFrom(TypeMember other)
        {
            while (!ReferenceEquals(other, null))
            {
                if (ReferenceEquals(other, this))
                {
                    return(true);
                }

                if (other.Interfaces.Contains(this))
                {
                    return(true);
                }

                other = other.BaseType;
            }

            return(false);
        }
Exemplo n.º 5
0
 public AttributeDescription TryGetAttribute(TypeMember attributeType)
 {
     return(Attributes.FirstOrDefault(attr => attr.AttributeType == attributeType));
 }
Exemplo n.º 6
0
 public TypeGeneratorInfo(Type factoryType, TypeKey?typeKey, TypeMember activationContract)
 {
     FactoryType        = factoryType;
     TypeKey            = typeKey;
     ActivationContract = activationContract;
 }
Exemplo n.º 7
0
 public IEnumerable <TMember> Attribute(TypeMember attributeType)
 {
     return(_source.Where(t => t.Attributes.Any(a => a.AttributeType == attributeType)));
 }