コード例 #1
0
            internal LoadableClassInfo(LoadableClassAttributeBase attr, MethodInfo getter, ConstructorInfo ctor, MethodInfo create, bool requireEnvironment)
            {
                Contracts.AssertValue(attr);
                Contracts.AssertValue(attr.InstanceType);
                Contracts.AssertValue(attr.LoaderType);
                Contracts.AssertValueOrNull(attr.Summary);
                Contracts.AssertValueOrNull(attr.DocName);
                Contracts.AssertValueOrNull(attr.UserName);
                Contracts.AssertNonEmpty(attr.LoadNames);
                Contracts.Assert(getter == null || Utils.Size(attr.CtorTypes) == 0);

                Type       = attr.InstanceType;
                LoaderType = attr.LoaderType;
                Summary    = attr.Summary;
                UserName   = attr.UserName;
                LoadNames  = attr.LoadNames.AsReadOnly();

                if (getter != null)
                {
                    InstanceGetter = getter;
                }
                else if (ctor != null)
                {
                    Constructor = ctor;
                }
                else if (create != null)
                {
                    CreateMethod = create;
                }
                ArgType            = attr.ArgType;
                SignatureTypes     = attr.SigTypes.AsReadOnly();
                CtorTypes          = attr.CtorTypes ?? Type.EmptyTypes;
                RequireEnvironment = requireEnvironment;

                if (!string.IsNullOrWhiteSpace(attr.DocName))
                {
                    DocName = attr.DocName;
                }

                Contracts.Assert(ArgType == null || CtorTypes.Length > 0 && CtorTypes[0] == ArgType);
            }