コード例 #1
0
        /// <summary>
        /// 初始化一个新的图文响应消息实例。
        /// </summary>
        /// <param name="articles">文章信息。</param>
        /// <exception cref="ArgumentNullException"><paramref name="articles"/> 为 null。</exception>
        /// <exception cref="ArgumentException"><paramref name="articles"/> 长度大于 <see cref="ArticleMaxCount"/> 10。</exception>
        public ResponseMessageNews(Article[] articles)
        {
            if (articles.NotNull("articles").Length > ArticleMaxCount)
                throw new ArgumentException(string.Format("文章数量不能大于 {0} 条。", ArticleMaxCount), "articles");

            Articles = articles;
        }
コード例 #2
0
        /// <summary>
        /// 初始化一个新的图文客服消息。
        /// </summary>
        /// <param name="toUserId">接收消息的用户Id。</param>
        /// <param name="articles">图文项。</param>
        public CustomServiceMessageNews(string toUserId, Article[] articles)
            : base(toUserId)
        {
            if (articles.NotNull("articles").Length > ArticleMaxCount)
                throw new ArgumentException(string.Format("文章数量不能大于 {0} 条。", ArticleMaxCount), "articles");

            Articles = articles;
        }