コード例 #1
0
        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;
        }
コード例 #2
0
        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);
        }
コード例 #3
0
            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))));
            }
コード例 #4
0
ファイル: ProxyModule.cs プロジェクト: davidvmckay/ProxyFoo
            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)));
            }