public IEnumerable<IField> GetFields(ITypeResolveContext context, Predicate<IField> filter = null)
 {
     Substitution substitution = new Substitution(typeArguments);
     List<IField> fields = genericType.GetFields(context, filter).ToList();
     for (int i = 0; i < fields.Count; i++) {
         SpecializedField f = new SpecializedField(fields[i]);
         f.SetDeclaringType(this);
         f.ReturnType = f.ReturnType.Resolve(context).AcceptVisitor(substitution);
         fields[i] = f;
     }
     return fields;
 }
Esempio n. 2
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");
		}