コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BssomSecurity"/> class.
        /// </summary>
        protected BssomSecurity(BssomSecurity copyFrom)
        {
            if (copyFrom is null)
            {
                throw new ArgumentNullException(nameof(copyFrom));
            }

            MaximumObjectGraphDepth = copyFrom.MaximumObjectGraphDepth;
        }
コード例 #2
0
        /// <summary>
        /// <para>获取这些选项的副本,并将<see cref="MaximumObjectGraphDepth"/>属性设置为新值</para>
        /// <para>Gets a copy of these options with the <see cref="MaximumObjectGraphDepth"/> property set to a new value.</para>
        /// </summary>
        /// <param name="maximumObjectGraphDepth"></param>
        /// <returns></returns>
        public BssomSecurity WithMaximumObjectGraphDepth(int maximumObjectGraphDepth)
        {
            if (MaximumObjectGraphDepth == maximumObjectGraphDepth)
            {
                return(this);
            }

            BssomSecurity clone = Clone();

            clone.MaximumObjectGraphDepth = maximumObjectGraphDepth;
            return(clone);
        }
コード例 #3
0
        /// <summary>
        /// <para>获取将<see cref="Security"/>属性设置为新值的<see cref="BssomSerializerOptions"/>副本</para>
        /// <para>Get a copy of <see cref="BssomSerializerOptions"/> with the <see cref="Security"/> attribute set to the new value</para>
        /// </summary>
        /// <param name="security"><see cref="Security"/>的新值. The new value for the <seealso cref="Security"/></param>
        /// <returns>一个新的实例,实例内的其它属性都没有改变. The new instance,none of the other properties within the instance change</returns>
        public BssomSerializerOptions WithSecurity(BssomSecurity security)
        {
            if (security is null)
            {
                throw new ArgumentNullException(nameof(security));
            }

            if (Security == security)
            {
                return(this);
            }

            BssomSerializerOptions result = Clone();

            result.Security = security;
            return(result);
        }