internal static DuckValueBindingOption TryBind(Type fromType, Type toType) { if (!toType.IsInterface || !fromType.IsSealed) return null; var pcd = new ProxyClassDescriptor( new StaticFactoryMixin(), new MethodExistsProxyMetaMixin(), new RealSubjectMixin(fromType, new DuckProxySubject(toType))); return pcd.IsValid() ? new StaticDuckCastValueBinding(pcd,fromType) : null; }
internal static DuckValueBindingOption TryBind(Type fromType, Type toType) { if (!toType.IsInterface() || !fromType.IsSealed()) { return(null); } var pcd = new ProxyClassDescriptor( new StaticFactoryMixin(), new MethodExistsProxyMetaMixin(), new RealSubjectMixin(fromType, new DuckProxySubject(toType))); return(pcd.IsValid() ? new StaticDuckCastValueBinding(pcd, fromType) : null); }
public IFooType GetTypeFromProxyClassDescriptor(ProxyClassDescriptor pcd) { IFooTypeBuilder result; if (_typesInProgress.TryGetValue(pcd, out result)) { return(result); } if (!pcd.IsValid()) { return(null); } var pcc = new ProxyClassCoder(this, pcd); return(new FooTypeFromType(pcc.Generate(t => _typesInProgress.Add(pcd, t)))); }
public IFooType GetTypeFromProxyClassDescriptor(ProxyClassDescriptor pcd) { IFooTypeBuilder result; if (_typesInProgress.TryGetValue(pcd, out result)) return result; if (!pcd.IsValid()) return null; var pcc = new ProxyClassCoder(this, pcd); return new FooTypeFromType(pcc.Generate(t => _typesInProgress.Add(pcd, t))); }