コード例 #1
0
        public override Instance CloseType(Type[] types)
        {
            if (!_plugin.PluggedType.IsOpenGeneric())
            {
                return(null);
            }

            Type closedType;

            try {
                closedType = _plugin.PluggedType.MakeGenericType(types);
            }
            catch {
                return(null);
            }

            var closedInstance = new ConstructorInstance(closedType);

            _dependencies.Each((key, i) => {
                if (i.CopyAsIsWhenClosingInstance)
                {
                    closedInstance.SetChild(key, i);
                }
            });

            return(closedInstance);
        }
コード例 #2
0
        public ConstructorInstance Override(ExplicitArguments arguments)
        {
            var instance = new ConstructorInstance(_plugin);

            _dependencies.Each((key, i) => instance.SetChild(key, i));

            arguments.Configure(instance);

            return(instance);
        }