Пример #1
0
        /// <summary> Builds a list of names of the specified type's members that are arguments to the constructor. </summary>
        private List <string> BuildConstructorParamSources(Type type)
        {
            PublishDefaultConstructorAttribute constructorAttribute = (PublishDefaultConstructorAttribute)ReflectionUtility.GetAttribute(type, typeof(PublishDefaultConstructorAttribute));

            if ((constructorAttribute != null) && (constructorAttribute.ConstructorSignature != String.Empty))
            {
                List <string>          result     = new List <string>();
                ParameterInfo[]        parameters = ReflectionUtility.FindConstructor(constructorAttribute.ConstructorSignature, type).GetParameters();
                PublishSourceAttribute source;
                foreach (ParameterInfo parameter in parameters)
                {
                    source = (PublishSourceAttribute)ReflectionUtility.GetAttribute(parameter, typeof(PublishSourceAttribute));
                    if ((source != null) && (source.MemberName != String.Empty))
                    {
                        result.Add(source.MemberName);
                    }
                }
                return(result);
            }
            else
            {
                return(null);
            }
        }