ImageMagick.Throw.IfFalse C# (CSharp) Метод

IfFalse() публичный статический Метод

public static IfFalse ( string paramName, bool condition, string message ) : void
paramName string
condition bool
message string
Результат void
    public static void IfFalse(string paramName, bool condition, string message, params object[] args)
    {
      if (!condition)
        throw new ArgumentException(FormatMessage(message, args), paramName);
    }

Usage Example

Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PerceptualHash"/> class.
        /// </summary>
        /// <param name="perceptualHash">The</param>
        public PerceptualHash(string perceptualHash)
            : this()
        {
            Throw.IfNullOrEmpty(nameof(perceptualHash), perceptualHash);
            Throw.IfFalse(nameof(perceptualHash), perceptualHash.Length == 210, "Invalid hash size.");

            _Channels[PixelChannel.Red]   = new ChannelPerceptualHash(PixelChannel.Red, perceptualHash.Substring(0, 70));
            _Channels[PixelChannel.Green] = new ChannelPerceptualHash(PixelChannel.Green, perceptualHash.Substring(70, 70));
            _Channels[PixelChannel.Blue]  = new ChannelPerceptualHash(PixelChannel.Blue, perceptualHash.Substring(140, 70));
        }
All Usage Examples Of ImageMagick.Throw::IfFalse