private static void AddToProxy(this MethodInfo[] methods, WrapperObject target, IDictionary <String, BaseProxy> proxies, INameSelector selector) { foreach (var method in methods.Where(m => !m.IsSpecialName).GroupBy(m => m.Name)) { var overloads = method.ToArray(); var name = selector.Select(proxies.Keys, overloads[0]); proxies.Add(name, new MethodProxy(target, overloads)); } }
private static void AddToProxy(this FieldInfo[] fields, WrapperObject target, IDictionary <String, BaseProxy> proxies, INameSelector selector) { foreach (var field in fields) { var name = selector.Select(proxies.Keys, field); proxies.Add(name, new FieldProxy(target, field)); } }
private static void AddToProxy(this PropertyInfo[] properties, WrapperObject target, IDictionary <String, BaseProxy> proxies, INameSelector selector) { var indices = new List <PropertyInfo>(); foreach (var property in properties) { if (property.GetIndexParameters().Length == 0) { var name = selector.Select(proxies.Keys, property); proxies.Add(name, new PropertyProxy(target, property)); } else { indices.Add(property); } } if (indices.Count > 0) { var name = selector.Select(proxies.Keys, indices[0]); proxies[name] = new IndexProxy(target, indices.ToArray()); } }
private static void AddToProxy(this ConstructorInfo[] constructors, WrapperObject target, IDictionary <String, BaseProxy> proxies, INameSelector selector) { if (constructors.Length > 0) { var name = selector.Select(proxies.Keys, constructors[0]); proxies[name] = new ConstructorProxy(target, constructors); } }