Exemple #1
0
        /// <summary>
        /// Sets the ignore if default convention.
        /// </summary>
        /// <param name="convention">An ignore if default convention.</param>
        /// <returns>The convention profile.</returns>
        public ConventionProfile SetIgnoreIfDefaultConvention(IIgnoreIfDefaultConvention convention)
        {
#pragma warning disable 618 // SerializeDefaultValueConvention is obsolete
            if (convention != null && SerializeDefaultValueConvention != null)
            {
                throw new InvalidOperationException("IgnoreIfDefaultConvention cannot be set because SerializeDefaultValueConvention is set.");
            }
#pragma warning restore 618
            IgnoreIfDefaultConvention = convention;
            return(this);
        }
Exemple #2
0
 public IgnoreIfDefaultConventionAdapter(IIgnoreIfDefaultConvention convention)
 {
     _convention = convention;
 }
 public IgnoreIfDefaultConventionAdapter(IIgnoreIfDefaultConvention convention)
 {
     _convention = convention;
 }
        /// <summary>
        /// Sets the ignore if default convention.
        /// </summary>
        /// <param name="convention">An ignore if default convention.</param>
        /// <returns>The convention profile.</returns>
        public ConventionProfile SetIgnoreIfDefaultConvention(IIgnoreIfDefaultConvention convention)
        {
#pragma warning disable 618 // SerializeDefaultValueConvention is obsolete
            if (convention != null && SerializeDefaultValueConvention != null)
            {
                throw new InvalidOperationException("IgnoreIfDefaultConvention cannot be set because SerializeDefaultValueConvention is set.");
            }
#pragma warning restore 618
            IgnoreIfDefaultConvention = convention;
            return this;
        }