/// <summary>
        /// Get the non-static constructor with the specified parameters.
        /// </summary>
        public override ConstructorRef GetConstructor(params TypeRefBase[] parameterTypes)
        {
            ConstructorDecl found = GetMethod <ConstructorDecl>(Name, parameterTypes);

            if (found != null)
            {
                return((ConstructorRef)found.CreateRef());
            }
            return(null);  // Don't look in base types for DelegateDecls
        }
        /// <summary>
        /// Get the non-static constructor with the specified parameters.
        /// </summary>
        public virtual ConstructorRef GetConstructor(params TypeRefBase[] parameterTypes)
        {
            ConstructorDecl found = GetMethod <ConstructorDecl>(_name, parameterTypes);

            if (found != null)
            {
                return((ConstructorRef)found.CreateRef());
            }
            TypeRef baseRef = GetBaseType();

            return(baseRef != null ? baseRef.GetConstructor(parameterTypes) : null);
        }
示例#3
0
 protected ConstructorInitializer(ConstructorDecl constructorDecl, params Expression[] parameters)
     : base(constructorDecl.CreateRef(), parameters)
 {
 }
 /// <summary>
 /// Create a <see cref="NewObject"/>.
 /// </summary>
 /// <param name="constructorDecl">The ConstructorDecl of the object being created.</param>
 /// <param name="parameters">The constructor parameters (if any).</param>
 public NewObject(ConstructorDecl constructorDecl, params Expression[] parameters)
     : base(constructorDecl.DeclaringType.CreateRef(), parameters)
 {
     SetField(ref _constructorRef, constructorDecl.CreateRef(), false);
 }