Ejemplo n.º 1
0
        public override bool Equals(object obj)
        {
            SpecializedProperty other = obj as SpecializedProperty;

            if (other == null)
            {
                return(false);
            }
            return(object.Equals(this.memberDefinition, other.memberDefinition) && object.Equals(this.declaringType, other.declaringType));
        }
Ejemplo n.º 2
0
 public IEnumerable<IProperty> GetProperties(ITypeResolveContext context, Predicate<IProperty> filter = null)
 {
     Substitution substitution = new Substitution(typeArguments);
     List<IProperty> properties = genericType.GetProperties(context, filter).ToList();
     for (int i = 0; i < properties.Count; i++) {
         SpecializedProperty p = new SpecializedProperty(properties[i]);
         p.SetDeclaringType(this);
         p.SubstituteTypes(context, substitution);
         properties[i] = p;
     }
     return properties;
 }
Ejemplo n.º 3
0
		IMember Specialize(IMember member, Func<ITypeReference, ITypeReference> substitution)
		{
			IMethod method = member as IMethod;
			if (method != null) {
				SpecializedMethod m = new SpecializedMethod(method);
				m.SetDeclaringType(this);
				m.SubstituteTypes(substitution);
				return m;
			}
			IProperty property = member as IProperty;
			if (property != null) {
				SpecializedProperty p = new SpecializedProperty(property);
				p.SetDeclaringType(this);
				p.SubstituteTypes(substitution);
				return p;
			}
			IField field = member as IField;
			if (field != null) {
				SpecializedField f = new SpecializedField(field);
				f.SetDeclaringType(this);
				f.ReturnType = substitution(f.ReturnType);
				return f;
			}
			IEvent ev = member as IEvent;
			if (ev != null) {
				SpecializedEvent e = new SpecializedEvent(ev);
				e.SetDeclaringType(this);
				e.ReturnType = substitution(e.ReturnType);
				return e;
			}
			throw new ArgumentException("Unknown member");
		}