• ASP.NET Core API
  • Core API
  • Mail API
  • Json API
  • Core API
  • Cuemon
  • Validator

    Show / Hide Table of Contents
    • Cuemon
      • ActionFactory
      • ActionFactory<TTuple>
      • ArgumentEmptyException
      • AssignmentOperator
      • AssignmentUtility
      • ByteConverter
      • ByteConverterExtensions
      • ByteExtensions
      • ByteUtility
      • ByteUtilityExtensions
      • CasingMethod
      • CharConverter
      • CharConverterExtensions
      • Condition
      • ConditionBuilder<TTuple>
      • ConditionExtensions
      • Converter
      • ConverterExtensions
      • ConvertibleConverter
      • ConvertibleConverterExtensions
      • DataPair
      • DataPair<T>
      • DateSpan
      • DateTimeConverter
      • DateTimeConverterExtensions
      • DateTimeExtensions
      • DateTimeFormatPattern
      • DayPart
      • DayParts
      • DelegateUtility
      • DelegateUtilityExtensions
      • DoubleConverter
      • DoubleConverterExtensions
      • EnumUtility
      • EnumUtilityExtensions
      • EventUtility
      • ExceptionUtility
      • ExceptionUtilityExtensions
      • FuncFactory
      • FuncFactory<TTuple, TResult>
      • GuidConverter
      • GuidConverterExtensions
      • GuidFormats
      • GuidUtility
      • Hierarchy<T>
      • HierarchyExtensions
      • HierarchySerializer
      • HierarchyUtility
      • HorizontalDirection
      • IData
      • IHierarchy<T>
      • IndexMapping
      • Initializer
      • InitializerBuilder<T>
      • IntegerExtensions
      • IWrapper<T>
      • LatencyException
      • LoopUtility
      • Mapping
      • MappingExtensions
      • MethodWrappedException
      • NumberUtility
      • NumberUtilityExtensions
      • ObjectConverter
      • PreambleSequence
      • RandomSeverity
      • RelationalOperator
      • RoundOffAccuracy
      • SortOrder
      • StandardizedDateTimeFormatPattern
      • StringConverter
      • StringConverterExtensions
      • StringExtensions
      • StringFormatter
      • StringReplacePair
      • StringUtility
      • StringUtilityExtensions
      • StructUtility
      • StructUtilityExtensions
      • TaskActionFactory
      • TaskActionFactory<TTuple>
      • TaskFuncFactory
      • TaskFuncFactory<TTuple, TResult>
      • Template
      • Template<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20>
      • Template<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19>
      • Template<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18>
      • Template<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17>
      • Template<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>
      • Template<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>
      • Template<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>
      • Template<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>
      • Template<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>
      • Template<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>
      • Template<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>
      • Template<T1, T2, T3, T4, T5, T6, T7, T8, T9>
      • Template<T1, T2, T3, T4, T5, T6, T7, T8>
      • Template<T1, T2, T3, T4, T5, T6, T7>
      • Template<T1, T2, T3, T4, T5, T6>
      • Template<T1, T2, T3, T4, T5>
      • Template<T1, T2, T3, T4>
      • Template<T1, T2, T3>
      • Template<T1, T2>
      • Template<T1>
      • TemplateFactory<TTuple>
      • TesterDoer
      • TesterFunc<T, TResult, TSuccess>
      • TesterFunc<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult, TSuccess>
      • TesterFunc<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult, TSuccess>
      • TesterFunc<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult, TSuccess>
      • TesterFunc<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult, TSuccess>
      • TesterFunc<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult, TSuccess>
      • TesterFunc<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult, TSuccess>
      • TesterFunc<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult, TSuccess>
      • TesterFunc<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult, TSuccess>
      • TesterFunc<T1, T2, T3, T4, T5, T6, T7, T8, TResult, TSuccess>
      • TesterFunc<T1, T2, T3, T4, T5, T6, T7, TResult, TSuccess>
      • TesterFunc<T1, T2, T3, T4, T5, T6, TResult, TSuccess>
      • TesterFunc<T1, T2, T3, T4, T5, TResult, TSuccess>
      • TesterFunc<T1, T2, T3, T4, TResult, TSuccess>
      • TesterFunc<T1, T2, T3, TResult, TSuccess>
      • TesterFunc<T1, T2, TResult, TSuccess>
      • TesterFunc<TResult, TSuccess>
      • TesterFuncFactory
      • TesterFuncFactory<TTuple, TResult, TSuccess>
      • TesterFuncUtility
      • TimeRange
      • TimeSpanConverter
      • TimeSpanConverterExtensions
      • TimeSpanExtensions
      • TimeUnit
      • TransientFaultEvidence
      • TransientFaultException
      • TransientOperation
      • TransientOperationOptions
      • TupleUtility
      • Tweaker
      • TweakerExtensions
      • TypeArgumentException
      • TypeArgumentOutOfRangeException
      • TypeCodeConverter
      • TypeCodeConverterExtensions
      • TypeExtensions
      • TypeUtility
      • TypeUtilityExtensions
      • UriConverter
      • UriScheme
      • UriSchemeConverter
      • UriUtility
      • Validator
      • VersionUtility
      • VerticalDirection
      • Wrapper
      • Wrapper<T>
      • WrapperExtensions
    • Cuemon.Collections
      • DataPairCollection
      • DataPairDictionary
    • Cuemon.Collections.Generic
      • CollectionExtensions
      • ComparisonUtility
      • ConditionalCollection<T>
      • DictionaryConverter
      • DictionaryConverterExtensions
      • DictionaryExtensions
      • DictionaryUtility
      • DictionaryUtilityExtensions
      • DynamicComparer
      • DynamicEqualityComparer
      • EnumerableConverter
      • EnumerableConverterExtensions
      • EnumerableExtensions
      • EnumerableSizeComparer<T>
      • EnumerableUtility
      • EnumerableUtilityExtensions
      • ISortableTable<TSource>
      • ListExtensions
      • ListUtility
      • ListUtilityExtensions
      • PagedCollection
      • PagedCollection<T>
      • PagedCollectionExtensions
      • PagedSettings
      • PartitionCollection<T>
      • PartitionCollectionExtensions
      • ReferenceComparer<T>
    • Cuemon.Collections.Specialized
      • NameValueCollectionConverter
      • NameValueCollectionConverterExtensions
      • NameValueCollectionUtility
    • Cuemon.Configuration
      • Configurable<TOptions>
      • IConfigurable<TOptions>
    • Cuemon.Data
      • BulkCopyDataReader
      • DataAdapter
      • DataAdapterEventArgs
      • DataAdapterException
      • DataCommand
      • DataConnection
      • DataDependency
      • DataManager
      • DataParameterEqualityComparer
      • DataTransfer
      • DataTransferColumn
      • DataTransferColumnCollection
      • DataTransferExtensions
      • DataTransferRow
      • DataTransferRowCollection
      • DataTransferSorter
      • DataWatcher
      • DbColumn
      • IDataCommand
      • IDataConnection
      • InOperator<T>
      • QueryBuilder
      • QueryFormat
      • QueryInsertAction
      • QueryType
      • QueryUtility
      • StringDataReader
      • UniqueIndexViolationException
    • Cuemon.Data.CsvClient
      • CsvDataReader
    • Cuemon.Data.SqlClient
      • SqlDataManager
      • SqlInOperator<T>
      • SqlQueryBuilder
    • Cuemon.Data.XmlClient
      • XmlDataReader
    • Cuemon.Diagnostics
      • EventLogEntryType
      • ExceptionDescriptor
      • ExceptionDescriptorAttribute
      • FileVersionInfoExtensions
      • Profiler
      • ProfilerOptions
      • TimeMeasure
      • TimeMeasureOptions
      • TimeMeasureProfiler
      • TimeMeasureProfiler<TResult>
    • Cuemon.Globalization
      • IMessageLocalizer
      • RegionInfoExtensions
      • World
    • Cuemon.Integrity
      • CacheValidator
      • CacheValidatorExtensions
      • CacheValidatorOptions
      • ChecksumBuilder
      • ChecksumBuilderExtensions
      • ChecksumBuilderOptions
      • ChecksumMethod
      • ChecksumResult
      • ChecksumStrength
      • ICacheableEntity
      • ICacheableIntegrity
      • ICacheableTimestamp
    • Cuemon.IO
      • FileInfoConverter
      • JsonStreamConverter
      • StreamConverter
      • StreamConverterExtensions
      • StreamExtensions
      • StreamUtility
      • StreamUtilityExtensions
      • StreamWriterOptions
      • StreamWriterUtility
      • TextReaderConverter
      • TextReaderConverterExtensions
    • Cuemon.IO.Compression
      • CompressionType
      • CompressionUtility
      • CompressionUtilityExtensions
    • Cuemon.Messaging
      • DynamicCorrelation
      • DynamicRequest
      • ICorrelation
      • IRequest
    • Cuemon.Net
      • HttpStatusCodeExtensions
      • NetDependency
      • NetWatcher
    • Cuemon.Net.Http
      • HttpManager
      • HttpManagerExtensions
      • HttpManagerOptions
      • HttpMethodConverter
      • HttpMethodExtensions
      • HttpMethods
      • HttpRequestOptions
    • Cuemon.Reflection
      • ActivatorUtility
      • AssemblyUtility
      • AssemblyUtilityExtensions
      • MemberInfoExtensions
      • MethodBaseConverter
      • MethodBaseConverterExtensions
      • MethodDescriptor
      • ObjectHierarchyOptions
      • ParameterSignature
      • ReflectionUtility
      • ReflectionUtilityExtensions
      • ResourceMatch
    • Cuemon.Runtime
      • Dependency
      • DependencyEventArgs
      • IDependency
      • Watcher
      • WatcherEventArgs
    • Cuemon.Runtime.Caching
      • CacheCollection
      • CacheEventArgs
      • CachingManager
    • Cuemon.Runtime.Serialization
      • JsonConverter
      • JsonInstance
      • JsonInstanceCollection
      • JsonWriter
      • XmlJsonInstance
    • Cuemon.Security
      • Obfuscator
      • ObfuscatorMapping
      • SecureXmlObfuscator
      • SecurityToken
      • SecurityTokenSettings
      • SecurityUtility
      • XmlObfuscator
    • Cuemon.Security.Cryptography
      • AdvancedEncryptionStandardKeySize
      • AdvancedEncryptionStandardUtility
      • CyclicRedundancyCheck
      • CyclicRedundancyCheck32
      • HashAlgorithmType
      • HashOptions
      • HashResult
      • HashUtility
      • HashUtilityExtensions
      • HmacAlgorithmType
      • HmacUtility
      • HmacUtilityExtensions
      • KeyedHashOptions
      • PolynomialRepresentation
      • StreamHashOptions
      • StreamKeyedHashOptions
      • StringHashOptions
      • StringKeyedHashOptions
      • StrongNumberUtility
    • Cuemon.Security.Web
      • JsonWebToken
      • JsonWebTokenHashAlgorithm
      • JsonWebTokenHashAlgorithmConverter
      • JsonWebTokenHeader
      • JsonWebTokenPayload
    • Cuemon.Serialization
      • ExceptionDescriptorSerializationOptions
    • Cuemon.Serialization.Formatters
      • Formatter<TFormat>
      • FormatterExtensions
    • Cuemon.Serialization.Xml
      • DynamicXmlConverter
      • DynamicXmlSerializable
      • XmlConvert
      • XmlReaderExtensions
      • XmlSerializer
      • XmlSerializerSettings
      • XmlSerializerSettingsExtensions
      • XmlWriterExtensions
    • Cuemon.Serialization.Xml.Converters
      • DefaultXmlConverter
      • XmlConverter
      • XmlConverterListExtensions
    • Cuemon.Serialization.Xml.Formatters
      • XmlFormatter
      • XmlFormatterOptions
    • Cuemon.Text
      • EncodingConverter
      • EncodingExtensions
      • EncodingOptions
      • EncodingUtility
      • FallbackEncodingOptions
    • Cuemon.Threading
      • AsyncOptions
      • ParallelTasks
      • ThreadPoolUtility
    • Cuemon.Threading.Tasks
      • TaskExtensions
    • Cuemon.Web
      • FieldValueFilter
      • FieldValueSeparator
      • FormConverter
      • FormUtility
      • HeadersConverter
      • HeadersUtility
      • HttpUtility
      • HttpUtilityExtensions
      • QueryStringConverter
      • QueryStringUtility
    • Cuemon.Web.Security
      • WebSecurityUtility
      • WebSecurityUtilityExtensions
    • Cuemon.Xml
      • XmlConvertExtensions
      • XmlCopyOptions
      • XmlDocumentConverter
      • XmlEncodingUtility
      • XmlReaderConverter
      • XmlReaderUtility
      • XmlReaderUtilityExtensions
      • XmlStreamConverter
      • XmlUtility
      • XmlUtilityExtensions
      • XmlWriterUtility
      • XmlWriterUtilityExtensions
    • Cuemon.Xml.Linq
      • XElementExtensions
    • Cuemon.Xml.Serialization
      • SerializableOrder
      • XmlQualifiedEntity
      • XmlWrapper
    • Cuemon.Xml.XPath
      • XPathNavigableConverter

    Class Validator

    Provides a generic way to validate different types of arguments passed to members.

    Inheritance
    System.Object
    Validator
    Namespace: Cuemon
    Assembly: Cuemon.Core.dll
    Syntax
    public static class Validator

    Methods

    | Improve this Doc

    ThrowIf(Func<Boolean>, Func<String, String, Exception>, String, String)

    Validates from the provided condition. An exception is resolved and thrown if the condition evaluates true.

    Declaration
    public static void ThrowIf(Func<bool> condition, Func<string, string, Exception> exception, string paramName, string message)
    Parameters
    Type Name Description
    System.Func<System.Boolean> condition

    The function delegate that determines if an exception is thrown.

    System.Func<System.String, System.String, System.Exception> exception

    The function delegate that resolves the System.Exception to be thrown.

    System.String paramName

    The name of the parameter that caused the exception.

    System.String message

    A message that describes the error.

    Exceptions
    Type Condition
    System.ArgumentNullException

    condition is null -or- exception is null.

    | Improve this Doc

    ThrowIf<TValue>(TValue, Func<TValue, Boolean>, Func<String, String, Exception>, String, String)

    Validates the specified value from the provided condition. An exception is resolved and thrown if the condition evaluates true.

    Declaration
    public static void ThrowIf<TValue>(TValue value, Func<TValue, bool> condition, Func<string, string, Exception> exception, string paramName, string message)
    Parameters
    Type Name Description
    TValue value

    The value that will be evaluated by condition.

    System.Func<TValue, System.Boolean> condition

    The function delegate that determines if an exception is thrown.

    System.Func<System.String, System.String, System.Exception> exception

    The function delegate that resolves the System.Exception to be thrown.

    System.String paramName

    The name of the parameter that caused the exception.

    System.String message

    A message that describes the error.

    Type Parameters
    Name Description
    TValue

    The type of the value to evaluate.

    Exceptions
    Type Condition
    System.ArgumentNullException

    condition is null -or- exception is null.

    | Improve this Doc

    ThrowIf<TValue, T>(TValue, Func<TValue, T, Boolean>, T, Func<String, String, Exception>, String, String)

    Validates the specified value from the provided condition. An exception is resolved and thrown if the condition evaluates true.

    Declaration
    public static void ThrowIf<TValue, T>(TValue value, Func<TValue, T, bool> condition, T arg, Func<string, string, Exception> exception, string paramName, string message)
    Parameters
    Type Name Description
    TValue value

    The value that will be evaluated by condition.

    System.Func<TValue, T, System.Boolean> condition

    The function delegate that determines if an exception is thrown.

    T arg

    The parameter of the function delegate condition.

    System.Func<System.String, System.String, System.Exception> exception

    The function delegate that resolves the System.Exception to be thrown.

    System.String paramName

    The name of the parameter that caused the exception.

    System.String message

    A message that describes the error.

    Type Parameters
    Name Description
    TValue

    The type of the value to evaluate.

    T

    The type of the parameter of the function delegate condition.

    Exceptions
    Type Condition
    System.ArgumentNullException

    condition is null -or- exception is null.

    | Improve this Doc

    ThrowIf<TValue, T1, T2>(TValue, Func<TValue, T1, T2, Boolean>, T1, T2, Func<String, String, Exception>, String, String)

    Validates the specified value from the provided condition. An exception is resolved and thrown if the condition evaluates true.

    Declaration
    public static void ThrowIf<TValue, T1, T2>(TValue value, Func<TValue, T1, T2, bool> condition, T1 arg1, T2 arg2, Func<string, string, Exception> exception, string paramName, string message)
    Parameters
    Type Name Description
    TValue value

    The value that will be evaluated by condition.

    System.Func<TValue, T1, T2, System.Boolean> condition

    The function delegate that determines if an exception is thrown.

    T1 arg1

    The first parameter of the function delegate condition.

    T2 arg2

    The second parameter of the function delegate condition.

    System.Func<System.String, System.String, System.Exception> exception

    The function delegate that resolves the System.Exception to be thrown.

    System.String paramName

    The name of the parameter that caused the exception.

    System.String message

    A message that describes the error.

    Type Parameters
    Name Description
    TValue

    The type of the value to evaluate.

    T1

    The type of the first parameter of the function delegate condition.

    T2

    The type of the second parameter of the function delegate condition.

    Exceptions
    Type Condition
    System.ArgumentNullException

    condition is null -or- exception is null.

    | Improve this Doc

    ThrowIf<TValue, T1, T2, T3>(TValue, Func<TValue, T1, T2, T3, Boolean>, T1, T2, T3, Func<String, String, Exception>, String, String)

    Validates the specified value from the provided condition. An exception is resolved and thrown if the condition evaluates true.

    Declaration
    public static void ThrowIf<TValue, T1, T2, T3>(TValue value, Func<TValue, T1, T2, T3, bool> condition, T1 arg1, T2 arg2, T3 arg3, Func<string, string, Exception> exception, string paramName, string message)
    Parameters
    Type Name Description
    TValue value

    The value that will be evaluated by condition.

    System.Func<TValue, T1, T2, T3, System.Boolean> condition

    The function delegate that determines if an exception is thrown.

    T1 arg1

    The first parameter of the function delegate condition.

    T2 arg2

    The second parameter of the function delegate condition.

    T3 arg3

    The third parameter of the function delegate condition.

    System.Func<System.String, System.String, System.Exception> exception

    The function delegate that resolves the System.Exception to be thrown.

    System.String paramName

    The name of the parameter that caused the exception.

    System.String message

    A message that describes the error.

    Type Parameters
    Name Description
    TValue

    The type of the value to evaluate.

    T1

    The type of the first parameter of the function delegate condition.

    T2

    The type of the second parameter of the function delegate condition.

    T3

    The type of the third parameter of the function delegate condition.

    Exceptions
    Type Condition
    System.ArgumentNullException

    condition is null -or- exception is null.

    | Improve this Doc

    ThrowIf<TValue, T1, T2, T3, T4>(TValue, Func<TValue, T1, T2, T3, T4, Boolean>, T1, T2, T3, T4, Func<String, String, Exception>, String, String)

    Validates the specified value from the provided condition. An exception is resolved and thrown if the condition evaluates true.

    Declaration
    public static void ThrowIf<TValue, T1, T2, T3, T4>(TValue value, Func<TValue, T1, T2, T3, T4, bool> condition, T1 arg1, T2 arg2, T3 arg3, T4 arg4, Func<string, string, Exception> exception, string paramName, string message)
    Parameters
    Type Name Description
    TValue value

    The value that will be evaluated by condition.

    System.Func<TValue, T1, T2, T3, T4, System.Boolean> condition

    The function delegate that determines if an exception is thrown.

    T1 arg1

    The first parameter of the function delegate condition.

    T2 arg2

    The second parameter of the function delegate condition.

    T3 arg3

    The third parameter of the function delegate condition.

    T4 arg4

    The fourth parameter of the function delegate condition.

    System.Func<System.String, System.String, System.Exception> exception

    The function delegate that resolves the System.Exception to be thrown.

    System.String paramName

    The name of the parameter that caused the exception.

    System.String message

    A message that describes the error.

    Type Parameters
    Name Description
    TValue

    The type of the value to evaluate.

    T1

    The type of the first parameter of the function delegate condition.

    T2

    The type of the second parameter of the function delegate condition.

    T3

    The type of the third parameter of the function delegate condition.

    T4

    The type of the fourth parameter of the function delegate condition.

    Exceptions
    Type Condition
    System.ArgumentNullException

    condition is null -or- exception is null.

    | Improve this Doc

    ThrowIf<TValue, T1, T2, T3, T4, T5>(TValue, Func<TValue, T1, T2, T3, T4, T5, Boolean>, T1, T2, T3, T4, T5, Func<String, String, Exception>, String, String)

    Validates the specified value from the provided condition. An exception is resolved and thrown if the condition evaluates true.

    Declaration
    public static void ThrowIf<TValue, T1, T2, T3, T4, T5>(TValue value, Func<TValue, T1, T2, T3, T4, T5, bool> condition, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, Func<string, string, Exception> exception, string paramName, string message)
    Parameters
    Type Name Description
    TValue value

    The value that will be evaluated by condition.

    System.Func<TValue, T1, T2, T3, T4, T5, System.Boolean> condition

    The function delegate that determines if an exception is thrown.

    T1 arg1

    The first parameter of the function delegate condition.

    T2 arg2

    The second parameter of the function delegate condition.

    T3 arg3

    The third parameter of the function delegate condition.

    T4 arg4

    The fourth parameter of the function delegate condition.

    T5 arg5

    The fifth parameter of the function delegate condition.

    System.Func<System.String, System.String, System.Exception> exception

    The function delegate that resolves the System.Exception to be thrown.

    System.String paramName

    The name of the parameter that caused the exception.

    System.String message

    A message that describes the error.

    Type Parameters
    Name Description
    TValue

    The type of the value to evaluate.

    T1

    The type of the first parameter of the function delegate condition.

    T2

    The type of the second parameter of the function delegate condition.

    T3

    The type of the third parameter of the function delegate condition.

    T4

    The type of the fourth parameter of the function delegate condition.

    T5

    The type of the fifth parameter of the function delegate condition.

    Exceptions
    Type Condition
    System.ArgumentNullException

    condition is null -or- exception is null.

    | Improve this Doc

    ThrowIfContainsType(Object, String, String, Type[])

    Validates and throws an System.ArgumentOutOfRangeException if the specified value is contained within at least one of the specified types.

    Declaration
    public static void ThrowIfContainsType(object value, string paramName, string message, params Type[] types)
    Parameters
    Type Name Description
    System.Object value

    The value to be evaluated.

    System.String paramName

    The name of the parameter that caused the exception.

    System.String message

    A message that describes the error.

    System.Type[] types

    A variable number of System.Type arguments to match with the type of value.

    Exceptions
    Type Condition
    System.ArgumentNullException

    value is null - or - types is null.

    System.ArgumentOutOfRangeException

    value is contained within at least one of the specified types.

    | Improve this Doc

    ThrowIfContainsType(Object, String, Type[])

    Validates and throws an System.ArgumentOutOfRangeException if the specified value is contained within at least one of the specified types.

    Declaration
    public static void ThrowIfContainsType(object value, string paramName, params Type[] types)
    Parameters
    Type Name Description
    System.Object value

    The value to be evaluated.

    System.String paramName

    The name of the parameter that caused the exception.

    System.Type[] types

    A variable number of System.Type arguments to match with the type of value.

    Exceptions
    Type Condition
    System.ArgumentNullException

    value is null - or - types is null.

    System.ArgumentOutOfRangeException

    value is contained within at least one of the specified types.

    | Improve this Doc

    ThrowIfContainsType(Type, String, String, Type[])

    Validates and throws an System.ArgumentOutOfRangeException if the specified value is contained within at least one of the specified types.

    Declaration
    public static void ThrowIfContainsType(Type value, string paramName, string message, params Type[] types)
    Parameters
    Type Name Description
    System.Type value

    The value to be evaluated.

    System.String paramName

    The name of the parameter that caused the exception.

    System.String message

    A message that describes the error.

    System.Type[] types

    A variable number of System.Type arguments to match with the type of value.

    Exceptions
    Type Condition
    System.ArgumentNullException

    value is null - or - types is null.

    System.ArgumentOutOfRangeException

    value is contained within at least one of the specified types.

    | Improve this Doc

    ThrowIfContainsType(Type, String, Type[])

    Validates and throws an System.ArgumentOutOfRangeException if the specified value is contained within at least one of the specified types.

    Declaration
    public static void ThrowIfContainsType(Type value, string paramName, params Type[] types)
    Parameters
    Type Name Description
    System.Type value

    The value to be evaluated.

    System.String paramName

    The name of the parameter that caused the exception.

    System.Type[] types

    A variable number of System.Type arguments to match with the type of value.

    Exceptions
    Type Condition
    System.ArgumentNullException

    value is null - or - types is null.

    System.ArgumentOutOfRangeException

    value is contained within at least one of the specified types.

    | Improve this Doc

    ThrowIfContainsType<T>(String, String, Type[])

    Validates and throws an TypeArgumentOutOfRangeException if the specified T is contained within at least one of the specified types.

    Declaration
    public static void ThrowIfContainsType<T>(string typeParamName, string message, params Type[] types)
    Parameters
    Type Name Description
    System.String typeParamName

    The name of the type parameter that caused the exception.

    System.String message

    A message that describes the error.

    System.Type[] types

    A variable number of System.Type arguments to match with the type of T.

    Type Parameters
    Name Description
    T
    Exceptions
    Type Condition
    System.ArgumentNullException

    types is null.

    TypeArgumentOutOfRangeException

    T is contained within at least one of the specified types.

    | Improve this Doc

    ThrowIfContainsType<T>(String, Type[])

    Validates and throws an TypeArgumentOutOfRangeException if the specified T is contained within at least one of the specified types.

    Declaration
    public static void ThrowIfContainsType<T>(string typeParamName, params Type[] types)
    Parameters
    Type Name Description
    System.String typeParamName

    The name of the type parameter that caused the exception.

    System.Type[] types

    A variable number of System.Type arguments to match with the type of T.

    Type Parameters
    Name Description
    T
    Exceptions
    Type Condition
    System.ArgumentNullException

    types is null.

    TypeArgumentOutOfRangeException

    T is contained within at least one of the specified types.

    | Improve this Doc

    ThrowIfDistinctDifference(String, String, String, String)

    Validates and throws an System.ArgumentOutOfRangeException if there is a distinct difference between arbitrary and definite.

    Declaration
    public static void ThrowIfDistinctDifference(string definite, string arbitrary, string paramName, string message)
    Parameters
    Type Name Description
    System.String definite

    The value that specifies valid characters.

    System.String arbitrary

    The value to distinctively compare with definite.

    System.String paramName

    The name of the parameter that caused the exception.

    System.String message

    A message that describes the error.

    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    There is a distinct difference between arbitrary and definite.

    | Improve this Doc

    ThrowIfEmailAddress(String, String)

    Validates and throws an System.ArgumentException if the specified value has the format of an email address.

    Declaration
    public static void ThrowIfEmailAddress(string value, string paramName)
    Parameters
    Type Name Description
    System.String value

    The value to be evaluated.

    System.String paramName

    The name of the parameter that caused the exception.

    Exceptions
    Type Condition
    System.ArgumentException

    value cannot be an email address.

    | Improve this Doc

    ThrowIfEmailAddress(String, String, String)

    Validates and throws an System.ArgumentException if the specified value has the format of an email address.

    Declaration
    public static void ThrowIfEmailAddress(string value, string paramName, string message)
    Parameters
    Type Name Description
    System.String value

    The value to be evaluated.

    System.String paramName

    The name of the parameter that caused the exception.

    System.String message

    A message that describes the error.

    Exceptions
    Type Condition
    System.ArgumentException

    value cannot be an email address.

    | Improve this Doc

    ThrowIfEmpty(String, String)

    Validates and throws an ArgumentEmptyException if the specified value is empty.

    Declaration
    public static void ThrowIfEmpty(string value, string paramName)
    Parameters
    Type Name Description
    System.String value

    The value to be evaluated.

    System.String paramName

    The name of the parameter that caused the exception.

    Exceptions
    Type Condition
    ArgumentEmptyException

    value cannot be empty.

    | Improve this Doc

    ThrowIfEmpty(String, String, String)

    Validates and throws an ArgumentEmptyException if the specified value is empty.

    Declaration
    public static void ThrowIfEmpty(string value, string paramName, string message)
    Parameters
    Type Name Description
    System.String value

    The value to be evaluated.

    System.String paramName

    The name of the parameter that caused the exception.

    System.String message

    A message that describes the error.

    Exceptions
    Type Condition
    ArgumentEmptyException

    value cannot be empty.

    | Improve this Doc

    ThrowIfEnum<TEnum>(String, Boolean, String)

    Validates and throws an System.ArgumentException if the specified value represents an enumeration.

    Declaration
    public static void ThrowIfEnum<TEnum>(string value, bool ignoreCase, string paramName)
        where TEnum : struct, IConvertible
    Parameters
    Type Name Description
    System.String value

    The value to be evaluated.

    System.Boolean ignoreCase

    true to ignore case; false to regard case.

    System.String paramName

    The name of the parameter that caused the exception.

    Type Parameters
    Name Description
    TEnum

    The type of the enumeration.

    Exceptions
    Type Condition
    System.ArgumentException

    value represents an enumeration.

    | Improve this Doc

    ThrowIfEnum<TEnum>(String, Boolean, String, String)

    Validates and throws an System.ArgumentException if the specified value represents an enumeration.

    Declaration
    public static void ThrowIfEnum<TEnum>(string value, bool ignoreCase, string paramName, string message)
        where TEnum : struct, IConvertible
    Parameters
    Type Name Description
    System.String value

    The value to be evaluated.

    System.Boolean ignoreCase

    true to ignore case; false to regard case.

    System.String paramName

    The name of the parameter that caused the exception.

    System.String message

    A message that describes the error.

    Type Parameters
    Name Description
    TEnum

    The type of the enumeration.

    Exceptions
    Type Condition
    System.ArgumentException

    value represents an enumeration.

    | Improve this Doc

    ThrowIfEnum<TEnum>(String, String)

    Validates and throws an System.ArgumentException if the specified value represents an enumeration.

    Declaration
    public static void ThrowIfEnum<TEnum>(string value, string paramName)
        where TEnum : struct, IConvertible
    Parameters
    Type Name Description
    System.String value

    The value to be evaluated.

    System.String paramName

    The name of the parameter that caused the exception.

    Type Parameters
    Name Description
    TEnum

    The type of the enumeration.

    Exceptions
    Type Condition
    System.ArgumentException

    value represents an enumeration.

    | Improve this Doc

    ThrowIfEnumType<TEnum>(String)

    Validates and throws an TypeArgumentException if the specified TEnum represents an enumeration.

    Declaration
    public static void ThrowIfEnumType<TEnum>(string typeParamName)
    Parameters
    Type Name Description
    System.String typeParamName

    The name of the type parameter that caused the exception.

    Type Parameters
    Name Description
    TEnum

    The type to check is an enumeration.

    Exceptions
    Type Condition
    TypeArgumentException

    TEnum represents an enumeration.

    | Improve this Doc

    ThrowIfEnumType<TEnum>(String, String)

    Validates and throws an TypeArgumentException if the specified TEnum represents an enumeration.

    Declaration
    public static void ThrowIfEnumType<TEnum>(string typeParamName, string message)
    Parameters
    Type Name Description
    System.String typeParamName

    The name of the type parameter that caused the exception.

    System.String message

    A message that describes the error.

    Type Parameters
    Name Description
    TEnum

    The type to check is an enumeration.

    Exceptions
    Type Condition
    TypeArgumentException

    TEnum represents an enumeration.

    | Improve this Doc

    ThrowIfEqual<T>(T, T, IEqualityComparer<T>, String)

    Validates and throws an System.ArgumentOutOfRangeException if the specified x object are equal to the y object.

    Declaration
    public static void ThrowIfEqual<T>(T x, T y, IEqualityComparer<T> comparer, string paramName)
    Parameters
    Type Name Description
    T x

    The first object to compare.

    T y

    The second object to compare.

    System.Collections.Generic.IEqualityComparer<T> comparer

    The System.Collections.Generic.IEqualityComparer<T> implementation to use when comparing x and y.

    System.String paramName

    The name of the parameter that caused the exception.

    Type Parameters
    Name Description
    T

    The type of objects to compare.

    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    x and y are equal to one another.

    | Improve this Doc

    ThrowIfEqual<T>(T, T, IEqualityComparer<T>, String, String)

    Validates and throws an System.ArgumentOutOfRangeException if the specified x object are equal to the y object.

    Declaration
    public static void ThrowIfEqual<T>(T x, T y, IEqualityComparer<T> comparer, string paramName, string message)
    Parameters
    Type Name Description
    T x

    The first object to compare.

    T y

    The second object to compare.

    System.Collections.Generic.IEqualityComparer<T> comparer

    The System.Collections.Generic.IEqualityComparer<T> implementation to use when comparing x and y.

    System.String paramName

    The name of the parameter that caused the exception.

    System.String message

    A message that describes the error.

    Type Parameters
    Name Description
    T

    The type of objects to compare.

    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    x and y are equal to one another.

    | Improve this Doc

    ThrowIfEqual<T>(T, T, String)

    Validates and throws an System.ArgumentOutOfRangeException if the specified x object are equal to the y object.

    Declaration
    public static void ThrowIfEqual<T>(T x, T y, string paramName)
    Parameters
    Type Name Description
    T x

    The first object to compare.

    T y

    The second object to compare.

    System.String paramName

    The name of the parameter that caused the exception.

    Type Parameters
    Name Description
    T

    The type of objects to compare.

    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    x and y are equal to one another.

    | Improve this Doc

    ThrowIfEqual<T>(T, T, String, String)

    Validates and throws an System.ArgumentOutOfRangeException if the specified x object are equal to the y object.

    Declaration
    public static void ThrowIfEqual<T>(T x, T y, string paramName, string message)
    Parameters
    Type Name Description
    T x

    The first object to compare.

    T y

    The second object to compare.

    System.String paramName

    The name of the parameter that caused the exception.

    System.String message

    A message that describes the error.

    Type Parameters
    Name Description
    T

    The type of objects to compare.

    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    x and y are equal to one another.

    | Improve this Doc

    ThrowIfFalse(Boolean, String)

    Validates and throws an System.ArgumentException if the specified value is false.

    Declaration
    public static void ThrowIfFalse(bool value, string paramName)
    Parameters
    Type Name Description
    System.Boolean value

    The value to be evaluated.

    System.String paramName

    The name of the parameter that caused the exception.

    Exceptions
    Type Condition
    System.ArgumentException

    value must be true.

    | Improve this Doc

    ThrowIfFalse(Boolean, String, String)

    Validates and throws an System.ArgumentException if the specified value is false.

    Declaration
    public static void ThrowIfFalse(bool value, string paramName, string message)
    Parameters
    Type Name Description
    System.Boolean value

    The value to be evaluated.

    System.String paramName

    The name of the parameter that caused the exception.

    System.String message

    A message that describes the error.

    Exceptions
    Type Condition
    System.ArgumentException

    value must be true.

    | Improve this Doc

    ThrowIfGreaterThan<T>(T, T, String)

    Validates and throws an System.ArgumentOutOfRangeException if the specified x is greater than y.

    Declaration
    public static void ThrowIfGreaterThan<T>(T x, T y, string paramName)
        where T : struct, IConvertible
    Parameters
    Type Name Description
    T x

    The first object to compare.

    T y

    The second object to compare.

    System.String paramName

    The name of the parameter that caused the exception.

    Type Parameters
    Name Description
    T

    The type of objects to compare.

    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    x is greater than y.

    | Improve this Doc

    ThrowIfGreaterThan<T>(T, T, String, String)

    Validates and throws an System.ArgumentOutOfRangeException if the specified x is greater than y.

    Declaration
    public static void ThrowIfGreaterThan<T>(T x, T y, string paramName, string message)
        where T : struct, IConvertible
    Parameters
    Type Name Description
    T x

    The first object to compare.

    T y

    The second object to compare.

    System.String paramName

    The name of the parameter that caused the exception.

    System.String message

    A message that describes the error.

    Type Parameters
    Name Description
    T

    The type of objects to compare.

    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    x is greater than y.

    | Improve this Doc

    ThrowIfGreaterThanOrEqual<T>(T, T, String)

    Validates and throws an System.ArgumentOutOfRangeException if the specified x is greater than or equal to y.

    Declaration
    public static void ThrowIfGreaterThanOrEqual<T>(T x, T y, string paramName)
        where T : struct, IConvertible
    Parameters
    Type Name Description
    T x

    The first object to compare.

    T y

    The second object to compare.

    System.String paramName

    The name of the parameter that caused the exception.

    Type Parameters
    Name Description
    T

    The type of objects to compare.

    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    x is greater than or equal to y.

    | Improve this Doc

    ThrowIfGreaterThanOrEqual<T>(T, T, String, String)

    Validates and throws an System.ArgumentOutOfRangeException if the specified x is greater than or equal to y.

    Declaration
    public static void ThrowIfGreaterThanOrEqual<T>(T x, T y, string paramName, string message)
        where T : struct, IConvertible
    Parameters
    Type Name Description
    T x

    The first object to compare.

    T y

    The second object to compare.

    System.String paramName

    The name of the parameter that caused the exception.

    System.String message

    A message that describes the error.

    Type Parameters
    Name Description
    T

    The type of objects to compare.

    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    x is greater than or equal to y.

    | Improve this Doc

    ThrowIfGuid(String, GuidFormats, String)

    Validates and throws an System.ArgumentException if the specified value has the format of a System.Guid.

    Declaration
    public static void ThrowIfGuid(string value, GuidFormats format, string paramName)
    Parameters
    Type Name Description
    System.String value

    The value to be evaluated.

    GuidFormats format

    A bitmask comprised of one or more GuidFormats that specify how the GUID parsing is conducted.

    System.String paramName

    The name of the parameter that caused the exception.

    Exceptions
    Type Condition
    System.ArgumentException

    value cannot be a System.Guid.

    | Improve this Doc

    ThrowIfGuid(String, GuidFormats, String, String)

    Validates and throws an System.ArgumentException if the specified value has the format of a System.Guid.

    Declaration
    public static void ThrowIfGuid(string value, GuidFormats format, string paramName, string message)
    Parameters
    Type Name Description
    System.String value

    The value to be evaluated.

    GuidFormats format

    A bitmask comprised of one or more GuidFormats that specify how the GUID parsing is conducted.

    System.String paramName

    The name of the parameter that caused the exception.

    System.String message

    A message that describes the error.

    Exceptions
    Type Condition
    System.ArgumentException

    value cannot be a System.Guid.

    | Improve this Doc

    ThrowIfGuid(String, String)

    Validates and throws an System.ArgumentException if the specified value has the format of a System.Guid.

    Declaration
    public static void ThrowIfGuid(string value, string paramName)
    Parameters
    Type Name Description
    System.String value

    The value to be evaluated.

    System.String paramName

    The name of the parameter that caused the exception.

    Remarks

    This implementation only evaluates for GUID formats of: DigitFormat | BraceFormat | ParenthesisFormat, eg. 32 digits separated by hyphens; 32 digits separated by hyphens, enclosed in brackets and 32 digits separated by hyphens, enclosed in parentheses.
    The reason not to include NumberFormat, eg. 32 digits is the possible unintended GUID result of a MD5 string representation.

    Exceptions
    Type Condition
    System.ArgumentException

    value cannot be a System.Guid.

    | Improve this Doc

    ThrowIfHex(String, String)

    Validates and throws an System.ArgumentOutOfRangeException if the specified value is hexadecimal.

    Declaration
    public static void ThrowIfHex(string value, string paramName)
    Parameters
    Type Name Description
    System.String value

    The value to be evaluated.

    System.String paramName

    The name of the parameter that caused the exception.

    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    value cannot be hexadecimal.

    | Improve this Doc

    ThrowIfHex(String, String, String)

    Validates and throws an System.ArgumentOutOfRangeException if the specified value is hexadecimal.

    Declaration
    public static void ThrowIfHex(string value, string paramName, string message)
    Parameters
    Type Name Description
    System.String value

    The value to be evaluated.

    System.String paramName

    The name of the parameter that caused the exception.

    System.String message

    A message that describes the error.

    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    value cannot be hexadecimal.

    | Improve this Doc

    ThrowIfLowerThan<T>(T, T, String)

    Validates and throws an System.ArgumentOutOfRangeException if the specified x is lower than y.

    Declaration
    public static void ThrowIfLowerThan<T>(T x, T y, string paramName)
        where T : struct, IConvertible
    Parameters
    Type Name Description
    T x

    The first object to compare.

    T y

    The second object to compare.

    System.String paramName

    The name of the parameter that caused the exception.

    Type Parameters
    Name Description
    T

    The type of objects to compare.

    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    x is lower than y.

    | Improve this Doc

    ThrowIfLowerThan<T>(T, T, String, String)

    Validates and throws an System.ArgumentOutOfRangeException if the specified x is lower than y.

    Declaration
    public static void ThrowIfLowerThan<T>(T x, T y, string paramName, string message)
        where T : struct, IConvertible
    Parameters
    Type Name Description
    T x

    The first object to compare.

    T y

    The second object to compare.

    System.String paramName

    The name of the parameter that caused the exception.

    System.String message

    A message that describes the error.

    Type Parameters
    Name Description
    T

    The type of objects to compare.

    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    x is lower than y.

    | Improve this Doc

    ThrowIfLowerThanOrEqual<T>(T, T, String)

    Validates and throws an System.ArgumentOutOfRangeException if the specified x is lower than or equal to y.

    Declaration
    public static void ThrowIfLowerThanOrEqual<T>(T x, T y, string paramName)
        where T : struct, IConvertible
    Parameters
    Type Name Description
    T x

    The first object to compare.

    T y

    The second object to compare.

    System.String paramName

    The name of the parameter that caused the exception.

    Type Parameters
    Name Description
    T

    The type of objects to compare.

    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    x is lower than or equal to y.

    | Improve this Doc

    ThrowIfLowerThanOrEqual<T>(T, T, String, String)

    Validates and throws an System.ArgumentOutOfRangeException if the specified x is lower than or equal to y.

    Declaration
    public static void ThrowIfLowerThanOrEqual<T>(T x, T y, string paramName, string message)
        where T : struct, IConvertible
    Parameters
    Type Name Description
    T x

    The first object to compare.

    T y

    The second object to compare.

    System.String paramName

    The name of the parameter that caused the exception.

    System.String message

    A message that describes the error.

    Type Parameters
    Name Description
    T

    The type of objects to compare.

    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    x is lower than or equal to y.

    | Improve this Doc

    ThrowIfNot(Func<Boolean>, Func<String, String, Exception>, String, String)

    Validates from the provided condition. An exception is resolved and thrown if the condition evaluates false.

    Declaration
    public static void ThrowIfNot(Func<bool> condition, Func<string, string, Exception> exception, string paramName, string message)
    Parameters
    Type Name Description
    System.Func<System.Boolean> condition

    The function delegate that determines if an exception is thrown.

    System.Func<System.String, System.String, System.Exception> exception

    The function delegate that resolves the System.Exception to be thrown.

    System.String paramName

    The name of the parameter that caused the exception.

    System.String message

    A message that describes the error.

    Exceptions
    Type Condition
    System.ArgumentNullException

    condition is null -or- exception is null.

    | Improve this Doc

    ThrowIfNot<TValue>(TValue, Func<TValue, Boolean>, Func<String, String, Exception>, String, String)

    Validates the specified value from the provided condition. An exception is resolved and thrown if the condition evaluates false.

    Declaration
    public static void ThrowIfNot<TValue>(TValue value, Func<TValue, bool> condition, Func<string, string, Exception> exception, string paramName, string message)
    Parameters
    Type Name Description
    TValue value

    The value that will be evaluated by condition.

    System.Func<TValue, System.Boolean> condition

    The function delegate that determines if an exception is thrown.

    System.Func<System.String, System.String, System.Exception> exception

    The function delegate that resolves the System.Exception to be thrown.

    System.String paramName

    The name of the parameter that caused the exception.

    System.String message

    A message that describes the error.

    Type Parameters
    Name Description
    TValue

    The type of the value to evaluate.

    Exceptions
    Type Condition
    System.ArgumentNullException

    condition is null -or- exception is null.

    | Improve this Doc

    ThrowIfNot<TValue, T>(TValue, Func<TValue, T, Boolean>, T, Func<String, String, Exception>, String, String)

    Validates the specified value from the provided condition. An exception is resolved and thrown if the condition evaluates false.

    Declaration
    public static void ThrowIfNot<TValue, T>(TValue value, Func<TValue, T, bool> condition, T arg, Func<string, string, Exception> exception, string paramName, string message)
    Parameters
    Type Name Description
    TValue value

    The value that will be evaluated by condition.

    System.Func<TValue, T, System.Boolean> condition

    The function delegate that determines if an exception is thrown.

    T arg

    The parameter of the function delegate condition.

    System.Func<System.String, System.String, System.Exception> exception

    The function delegate that resolves the System.Exception to be thrown.

    System.String paramName

    The name of the parameter that caused the exception.

    System.String message

    A message that describes the error.

    Type Parameters
    Name Description
    TValue

    The type of the value to evaluate.

    T

    The type of the parameter of the function delegate condition.

    Exceptions
    Type Condition
    System.ArgumentNullException

    condition is null -or- exception is null.

    | Improve this Doc

    ThrowIfNot<TValue, T1, T2>(TValue, Func<TValue, T1, T2, Boolean>, T1, T2, Func<String, String, Exception>, String, String)

    Validates the specified value from the provided condition. An exception is resolved and thrown if the condition evaluates false.

    Declaration
    public static void ThrowIfNot<TValue, T1, T2>(TValue value, Func<TValue, T1, T2, bool> condition, T1 arg1, T2 arg2, Func<string, string, Exception> exception, string paramName, string message)
    Parameters
    Type Name Description
    TValue value

    The value that will be evaluated by condition.

    System.Func<TValue, T1, T2, System.Boolean> condition

    The function delegate that determines if an exception is thrown.

    T1 arg1

    The first parameter of the function delegate condition.

    T2 arg2

    The second parameter of the function delegate condition.

    System.Func<System.String, System.String, System.Exception> exception

    The function delegate that resolves the System.Exception to be thrown.

    System.String paramName

    The name of the parameter that caused the exception.

    System.String message

    A message that describes the error.

    Type Parameters
    Name Description
    TValue

    The type of the value to evaluate.

    T1

    The type of the first parameter of the function delegate condition.

    T2

    The type of the second parameter of the function delegate condition.

    Exceptions
    Type Condition
    System.ArgumentNullException

    condition is null -or- exception is null.

    | Improve this Doc

    ThrowIfNot<TValue, T1, T2, T3>(TValue, Func<TValue, T1, T2, T3, Boolean>, T1, T2, T3, Func<String, String, Exception>, String, String)

    Validates the specified value from the provided condition. An exception is resolved and thrown if the condition evaluates false.

    Declaration
    public static void ThrowIfNot<TValue, T1, T2, T3>(TValue value, Func<TValue, T1, T2, T3, bool> condition, T1 arg1, T2 arg2, T3 arg3, Func<string, string, Exception> exception, string paramName, string message)
    Parameters
    Type Name Description
    TValue value

    The value that will be evaluated by condition.

    System.Func<TValue, T1, T2, T3, System.Boolean> condition

    The function delegate that determines if an exception is thrown.

    T1 arg1

    The first parameter of the function delegate condition.

    T2 arg2

    The second parameter of the function delegate condition.

    T3 arg3

    The third parameter of the function delegate condition.

    System.Func<System.String, System.String, System.Exception> exception

    The function delegate that resolves the System.Exception to be thrown.

    System.String paramName

    The name of the parameter that caused the exception.

    System.String message

    A message that describes the error.

    Type Parameters
    Name Description
    TValue

    The type of the value to evaluate.

    T1

    The type of the first parameter of the function delegate condition.

    T2

    The type of the second parameter of the function delegate condition.

    T3

    The type of the third parameter of the function delegate condition.

    Exceptions
    Type Condition
    System.ArgumentNullException

    condition is null -or- exception is null.

    | Improve this Doc

    ThrowIfNot<TValue, T1, T2, T3, T4>(TValue, Func<TValue, T1, T2, T3, T4, Boolean>, T1, T2, T3, T4, Func<String, String, Exception>, String, String)

    Validates the specified value from the provided condition. An exception is resolved and thrown if the condition evaluates false.

    Declaration
    public static void ThrowIfNot<TValue, T1, T2, T3, T4>(TValue value, Func<TValue, T1, T2, T3, T4, bool> condition, T1 arg1, T2 arg2, T3 arg3, T4 arg4, Func<string, string, Exception> exception, string paramName, string message)
    Parameters
    Type Name Description
    TValue value

    The value that will be evaluated by condition.

    System.Func<TValue, T1, T2, T3, T4, System.Boolean> condition

    The function delegate that determines if an exception is thrown.

    T1 arg1

    The first parameter of the function delegate condition.

    T2 arg2

    The second parameter of the function delegate condition.

    T3 arg3

    The third parameter of the function delegate condition.

    T4 arg4

    The fourth parameter of the function delegate condition.

    System.Func<System.String, System.String, System.Exception> exception

    The function delegate that resolves the System.Exception to be thrown.

    System.String paramName

    The name of the parameter that caused the exception.

    System.String message

    A message that describes the error.

    Type Parameters
    Name Description
    TValue

    The type of the value to evaluate.

    T1

    The type of the first parameter of the function delegate condition.

    T2

    The type of the second parameter of the function delegate condition.

    T3

    The type of the third parameter of the function delegate condition.

    T4

    The type of the fourth parameter of the function delegate condition.

    Exceptions
    Type Condition
    System.ArgumentNullException

    condition is null -or- exception is null.

    | Improve this Doc

    ThrowIfNot<TValue, T1, T2, T3, T4, T5>(TValue, Func<TValue, T1, T2, T3, T4, T5, Boolean>, T1, T2, T3, T4, T5, Func<String, String, Exception>, String, String)

    Validates the specified value from the provided condition. An exception is resolved and thrown if the condition evaluates false.

    Declaration
    public static void ThrowIfNot<TValue, T1, T2, T3, T4, T5>(TValue value, Func<TValue, T1, T2, T3, T4, T5, bool> condition, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, Func<string, string, Exception> exception, string paramName, string message)
    Parameters
    Type Name Description
    TValue value

    The value that will be evaluated by condition.

    System.Func<TValue, T1, T2, T3, T4, T5, System.Boolean> condition

    The function delegate that determines if an exception is thrown.

    T1 arg1

    The first parameter of the function delegate condition.

    T2 arg2

    The second parameter of the function delegate condition.

    T3 arg3

    The third parameter of the function delegate condition.

    T4 arg4

    The fourth parameter of the function delegate condition.

    T5 arg5

    The fifth parameter of the function delegate condition.

    System.Func<System.String, System.String, System.Exception> exception

    The function delegate that resolves the System.Exception to be thrown.

    System.String paramName

    The name of the parameter that caused the exception.

    System.String message

    A message that describes the error.

    Type Parameters
    Name Description
    TValue

    The type of the value to evaluate.

    T1

    The type of the first parameter of the function delegate condition.

    T2

    The type of the second parameter of the function delegate condition.

    T3

    The type of the third parameter of the function delegate condition.

    T4

    The type of the fourth parameter of the function delegate condition.

    T5

    The type of the fifth parameter of the function delegate condition.

    Exceptions
    Type Condition
    System.ArgumentNullException

    condition is null -or- exception is null.

    | Improve this Doc

    ThrowIfNotContainsType(Object, String, String, Type[])

    Validates and throws an System.ArgumentOutOfRangeException if the specified value is not contained within at least one of the specified types.

    Declaration
    public static void ThrowIfNotContainsType(object value, string paramName, string message, params Type[] types)
    Parameters
    Type Name Description
    System.Object value

    The value to be evaluated.

    System.String paramName

    The name of the parameter that caused the exception.

    System.String message

    A message that describes the error.

    System.Type[] types

    A variable number of System.Type arguments to match with the type of value.

    Exceptions
    Type Condition
    System.ArgumentNullException

    value is null - or - types is null.

    System.ArgumentOutOfRangeException

    value is not contained within at least one of the specified types.

    | Improve this Doc

    ThrowIfNotContainsType(Object, String, Type[])

    Validates and throws an System.ArgumentOutOfRangeException if the specified value is not contained within at least one of the specified types.

    Declaration
    public static void ThrowIfNotContainsType(object value, string paramName, params Type[] types)
    Parameters
    Type Name Description
    System.Object value

    The value to be evaluated.

    System.String paramName

    The name of the parameter that caused the exception.

    System.Type[] types

    A variable number of System.Type arguments to match with the type of value.

    Exceptions
    Type Condition
    System.ArgumentNullException

    value is null - or - types is null.

    System.ArgumentOutOfRangeException

    value is not contained within at least one of the specified types.

    | Improve this Doc

    ThrowIfNotContainsType(Type, String, String, Type[])

    Validates and throws an System.ArgumentOutOfRangeException if the specified value is not contained within at least one of the specified types.

    Declaration
    public static void ThrowIfNotContainsType(Type value, string paramName, string message, params Type[] types)
    Parameters
    Type Name Description
    System.Type value

    The value to be evaluated.

    System.String paramName

    The name of the parameter that caused the exception.

    System.String message

    A message that describes the error.

    System.Type[] types

    A variable number of System.Type arguments to match with the type of value.

    Exceptions
    Type Condition
    System.ArgumentNullException

    value is null - or - types is null.

    System.ArgumentOutOfRangeException

    value is not contained within at least one of the specified types.

    | Improve this Doc

    ThrowIfNotContainsType(Type, String, Type[])

    Validates and throws an System.ArgumentOutOfRangeException if the specified value is not contained within at least one of the specified types.

    Declaration
    public static void ThrowIfNotContainsType(Type value, string paramName, params Type[] types)
    Parameters
    Type Name Description
    System.Type value

    The value to be evaluated.

    System.String paramName

    The name of the parameter that caused the exception.

    System.Type[] types

    A variable number of System.Type arguments to match with the type of value.

    Exceptions
    Type Condition
    System.ArgumentNullException

    value is null - or - types is null.

    System.ArgumentOutOfRangeException

    value is not contained within at least one of the specified types.

    | Improve this Doc

    ThrowIfNotContainsType<T>(String, String, Type[])

    Validates and throws an TypeArgumentOutOfRangeException if the specified T is not contained within at least one of the specified types.

    Declaration
    public static void ThrowIfNotContainsType<T>(string typeParamName, string message, params Type[] types)
    Parameters
    Type Name Description
    System.String typeParamName

    The name of the type parameter that caused the exception.

    System.String message

    A message that describes the error.

    System.Type[] types

    A variable number of System.Type arguments to match with the type of T.

    Type Parameters
    Name Description
    T
    Exceptions
    Type Condition
    System.ArgumentNullException

    types is null.

    TypeArgumentOutOfRangeException

    T is not contained within at least one of the specified types.

    | Improve this Doc

    ThrowIfNotContainsType<T>(String, Type[])

    Validates and throws an TypeArgumentOutOfRangeException if the specified T is not contained within at least one of the specified types.

    Declaration
    public static void ThrowIfNotContainsType<T>(string typeParamName, params Type[] types)
    Parameters
    Type Name Description
    System.String typeParamName

    The name of the type parameter that caused the exception.

    System.Type[] types

    A variable number of System.Type arguments to match with the type of T.

    Type Parameters
    Name Description
    T
    Exceptions
    Type Condition
    System.ArgumentNullException

    types is null.

    TypeArgumentOutOfRangeException

    T is not contained within at least one of the specified types.

    | Improve this Doc

    ThrowIfNotDistinctDifference(String, String, String, String)

    Validates and throws an System.ArgumentOutOfRangeException if there is not a distinct difference between arbitrary and definite.

    Declaration
    public static void ThrowIfNotDistinctDifference(string definite, string arbitrary, string paramName, string message)
    Parameters
    Type Name Description
    System.String definite

    The value that specifies valid characters.

    System.String arbitrary

    The value to distinctively compare with definite.

    System.String paramName

    The name of the parameter that caused the exception.

    System.String message

    A message that describes the error.

    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    There is not a distinct difference between arbitrary and definite.

    | Improve this Doc

    ThrowIfNotEmailAddress(String, String)

    Validates and throws an System.ArgumentException if the specified value does not have the format of an email address.

    Declaration
    public static void ThrowIfNotEmailAddress(string value, string paramName)
    Parameters
    Type Name Description
    System.String value

    The value to be evaluated.

    System.String paramName

    The name of the parameter that caused the exception.

    Exceptions
    Type Condition
    System.ArgumentException

    value must be an email address.

    | Improve this Doc

    ThrowIfNotEmailAddress(String, String, String)

    Validates and throws an System.ArgumentException if the specified value does not have the format of an email address.

    Declaration
    public static void ThrowIfNotEmailAddress(string value, string paramName, string message)
    Parameters
    Type Name Description
    System.String value

    The value to be evaluated.

    System.String paramName

    The name of the parameter that caused the exception.

    System.String message

    A message that describes the error.

    Exceptions
    Type Condition
    System.ArgumentException

    value must be an email address.

    | Improve this Doc

    ThrowIfNotEnum<TEnum>(String, Boolean, String)

    Validates and throws an System.ArgumentException if the specified value does not represents an enumeration.

    Declaration
    public static void ThrowIfNotEnum<TEnum>(string value, bool ignoreCase, string paramName)
        where TEnum : struct, IConvertible
    Parameters
    Type Name Description
    System.String value

    The value to be evaluated.

    System.Boolean ignoreCase

    true to ignore case; false to regard case.

    System.String paramName

    The name of the parameter that caused the exception.

    Type Parameters
    Name Description
    TEnum

    The type of the enumeration.

    Exceptions
    Type Condition
    System.ArgumentException

    value does not represents an enumeration.

    | Improve this Doc

    ThrowIfNotEnum<TEnum>(String, Boolean, String, String)

    Validates and throws an System.ArgumentException if the specified value does not represents an enumeration.

    Declaration
    public static void ThrowIfNotEnum<TEnum>(string value, bool ignoreCase, string paramName, string message)
        where TEnum : struct, IConvertible
    Parameters
    Type Name Description
    System.String value

    The value to be evaluated.

    System.Boolean ignoreCase

    true to ignore case; false to regard case.

    System.String paramName

    The name of the parameter that caused the exception.

    System.String message

    A message that describes the error.

    Type Parameters
    Name Description
    TEnum

    The type of the enumeration.

    Exceptions
    Type Condition
    System.ArgumentException

    value does not represents an enumeration.

    | Improve this Doc

    ThrowIfNotEnum<TEnum>(String, String)

    Validates and throws an System.ArgumentException if the specified value does not represents an enumeration.

    Declaration
    public static void ThrowIfNotEnum<TEnum>(string value, string paramName)
        where TEnum : struct, IConvertible
    Parameters
    Type Name Description
    System.String value

    The value to be evaluated.

    System.String paramName

    The name of the parameter that caused the exception.

    Type Parameters
    Name Description
    TEnum

    The type of the enumeration.

    Exceptions
    Type Condition
    System.ArgumentException

    value does not represents an enumeration.

    | Improve this Doc

    ThrowIfNotEnumType<TEnum>(String)

    Validates and throws an TypeArgumentException if the specified TEnum does not represents an enumeration.

    Declaration
    public static void ThrowIfNotEnumType<TEnum>(string typeParamName)
    Parameters
    Type Name Description
    System.String typeParamName

    The name of the type parameter that caused the exception.

    Type Parameters
    Name Description
    TEnum

    The type to check is not an enumeration.

    Exceptions
    Type Condition
    TypeArgumentException

    TEnum does not represents an enumeration.

    | Improve this Doc

    ThrowIfNotEnumType<TEnum>(String, String)

    Validates and throws an TypeArgumentException if the specified TEnum does not represents an enumeration.

    Declaration
    public static void ThrowIfNotEnumType<TEnum>(string typeParamName, string message)
    Parameters
    Type Name Description
    System.String typeParamName

    The name of the type parameter that caused the exception.

    System.String message

    A message that describes the error.

    Type Parameters
    Name Description
    TEnum

    The type to check is not an enumeration.

    Exceptions
    Type Condition
    TypeArgumentException

    TEnum does not represents an enumeration.

    | Improve this Doc

    ThrowIfNotEqual<T>(T, T, IEqualityComparer<T>, String)

    Validates and throws an System.ArgumentOutOfRangeException if the specified x object are not equal to the y object.

    Declaration
    public static void ThrowIfNotEqual<T>(T x, T y, IEqualityComparer<T> comparer, string paramName)
    Parameters
    Type Name Description
    T x

    The first object to compare.

    T y

    The second object to compare.

    System.Collections.Generic.IEqualityComparer<T> comparer

    The System.Collections.Generic.IEqualityComparer<T> implementation to use when comparing x and y.

    System.String paramName

    The name of the parameter that caused the exception.

    Type Parameters
    Name Description
    T

    The type of objects to compare.

    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    x and y are not equal to one another.

    | Improve this Doc

    ThrowIfNotEqual<T>(T, T, IEqualityComparer<T>, String, String)

    Validates and throws an System.ArgumentOutOfRangeException if the specified x object are not equal to the y object.

    Declaration
    public static void ThrowIfNotEqual<T>(T x, T y, IEqualityComparer<T> comparer, string paramName, string message)
    Parameters
    Type Name Description
    T x

    The first object to compare.

    T y

    The second object to compare.

    System.Collections.Generic.IEqualityComparer<T> comparer

    The System.Collections.Generic.IEqualityComparer<T> implementation to use when comparing x and y.

    System.String paramName

    The name of the parameter that caused the exception.

    System.String message

    A message that describes the error.

    Type Parameters
    Name Description
    T

    The type of objects to compare.

    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    x and y are not equal to one another.

    | Improve this Doc

    ThrowIfNotEqual<T>(T, T, String)

    Validates and throws an System.ArgumentOutOfRangeException if the specified x object are not equal to the y object.

    Declaration
    public static void ThrowIfNotEqual<T>(T x, T y, string paramName)
    Parameters
    Type Name Description
    T x

    The first object to compare.

    T y

    The second object to compare.

    System.String paramName

    The name of the parameter that caused the exception.

    Type Parameters
    Name Description
    T

    The type of objects to compare.

    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    x and y are not equal to one another.

    | Improve this Doc

    ThrowIfNotEqual<T>(T, T, String, String)

    Validates and throws an System.ArgumentOutOfRangeException if the specified x object are not equal to the y object.

    Declaration
    public static void ThrowIfNotEqual<T>(T x, T y, string paramName, string message)
    Parameters
    Type Name Description
    T x

    The first object to compare.

    T y

    The second object to compare.

    System.String paramName

    The name of the parameter that caused the exception.

    System.String message

    A message that describes the error.

    Type Parameters
    Name Description
    T

    The type of objects to compare.

    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    x and y are not equal to one another.

    | Improve this Doc

    ThrowIfNotGuid(String, GuidFormats, String)

    Validates and throws an System.ArgumentException if the specified value does not have the format of a System.Guid.

    Declaration
    public static void ThrowIfNotGuid(string value, GuidFormats format, string paramName)
    Parameters
    Type Name Description
    System.String value

    The value to be evaluated.

    GuidFormats format

    A bitmask comprised of one or more GuidFormats that specify how the GUID parsing is conducted.

    System.String paramName

    The name of the parameter that caused the exception.

    Exceptions
    Type Condition
    System.ArgumentException

    value must be a System.Guid.

    | Improve this Doc

    ThrowIfNotGuid(String, GuidFormats, String, String)

    Validates and throws an System.ArgumentException if the specified value does not have the format of a System.Guid.

    Declaration
    public static void ThrowIfNotGuid(string value, GuidFormats format, string paramName, string message)
    Parameters
    Type Name Description
    System.String value

    The value to be evaluated.

    GuidFormats format

    A bitmask comprised of one or more GuidFormats that specify how the GUID parsing is conducted.

    System.String paramName

    The name of the parameter that caused the exception.

    System.String message

    A message that describes the error.

    Exceptions
    Type Condition
    System.ArgumentException

    value must be a System.Guid.

    | Improve this Doc

    ThrowIfNotGuid(String, String)

    Validates and throws an System.ArgumentException if the specified value does not have the format of a System.Guid.

    Declaration
    public static void ThrowIfNotGuid(string value, string paramName)
    Parameters
    Type Name Description
    System.String value

    The value to be evaluated.

    System.String paramName

    The name of the parameter that caused the exception.

    Remarks

    This implementation only evaluates for GUID formats of: DigitFormat | BraceFormat | ParenthesisFormat, eg. 32 digits separated by hyphens; 32 digits separated by hyphens, enclosed in brackets and 32 digits separated by hyphens, enclosed in parentheses.
    The reason not to include NumberFormat, eg. 32 digits is the possible unintended GUID result of a MD5 string representation.

    Exceptions
    Type Condition
    System.ArgumentException

    value must be a System.Guid.

    | Improve this Doc

    ThrowIfNotHex(String, String)

    Validates and throws an System.ArgumentOutOfRangeException if the specified value is not hexadecimal.

    Declaration
    public static void ThrowIfNotHex(string value, string paramName)
    Parameters
    Type Name Description
    System.String value

    The value to be evaluated.

    System.String paramName

    The name of the parameter that caused the exception.

    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    value must be hexadecimal.

    | Improve this Doc

    ThrowIfNotHex(String, String, String)

    Validates and throws an System.ArgumentOutOfRangeException if the specified value is not hexadecimal.

    Declaration
    public static void ThrowIfNotHex(string value, string paramName, string message)
    Parameters
    Type Name Description
    System.String value

    The value to be evaluated.

    System.String paramName

    The name of the parameter that caused the exception.

    System.String message

    A message that describes the error.

    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    value must be hexadecimal.

    | Improve this Doc

    ThrowIfNotNumber(String, String)

    Validates and throws an System.ArgumentException if the specified value is not a number.

    Declaration
    public static void ThrowIfNotNumber(string value, string paramName)
    Parameters
    Type Name Description
    System.String value

    The value to be evaluated.

    System.String paramName

    The name of the parameter that caused the exception.

    Exceptions
    Type Condition
    System.ArgumentException

    value must be a number.

    | Improve this Doc

    ThrowIfNotNumber(String, String, NumberStyles)

    Validates and throws an System.ArgumentException if the specified value is not a number.

    Declaration
    public static void ThrowIfNotNumber(string value, string paramName, NumberStyles styles)
    Parameters
    Type Name Description
    System.String value

    The value to be evaluated.

    System.String paramName

    The name of the parameter that caused the exception.

    System.Globalization.NumberStyles styles

    A bitwise combination of System.Globalization.NumberStyles values that indicates the permitted format of value.

    Exceptions
    Type Condition
    System.ArgumentException

    value must be a number.

    | Improve this Doc

    ThrowIfNotNumber(String, String, NumberStyles, IFormatProvider)

    Validates and throws an System.ArgumentException if the specified value is not a number.

    Declaration
    public static void ThrowIfNotNumber(string value, string paramName, NumberStyles styles, IFormatProvider provider)
    Parameters
    Type Name Description
    System.String value

    The value to be evaluated.

    System.String paramName

    The name of the parameter that caused the exception.

    System.Globalization.NumberStyles styles

    A bitwise combination of System.Globalization.NumberStyles values that indicates the permitted format of value.

    System.IFormatProvider provider

    An System.IFormatProvider that supplies culture-specific formatting information about value.

    Exceptions
    Type Condition
    System.ArgumentException

    value must be a number.

    | Improve this Doc

    ThrowIfNotNumber(String, String, String)

    Validates and throws an System.ArgumentException if the specified value is not a number.

    Declaration
    public static void ThrowIfNotNumber(string value, string paramName, string message)
    Parameters
    Type Name Description
    System.String value

    The value to be evaluated.

    System.String paramName

    The name of the parameter that caused the exception.

    System.String message

    A message that describes the error.

    Exceptions
    Type Condition
    System.ArgumentException

    value must be a number.

    | Improve this Doc

    ThrowIfNotNumber(String, String, String, NumberStyles)

    Validates and throws an System.ArgumentException if the specified value is not a number.

    Declaration
    public static void ThrowIfNotNumber(string value, string paramName, string message, NumberStyles styles)
    Parameters
    Type Name Description
    System.String value

    The value to be evaluated.

    System.String paramName

    The name of the parameter that caused the exception.

    System.String message

    A message that describes the error.

    System.Globalization.NumberStyles styles

    A bitwise combination of System.Globalization.NumberStyles values that indicates the permitted format of value.

    Exceptions
    Type Condition
    System.ArgumentException

    value must be a number.

    | Improve this Doc

    ThrowIfNotNumber(String, String, String, NumberStyles, IFormatProvider)

    Validates and throws an System.ArgumentException if the specified value is not a number.

    Declaration
    public static void ThrowIfNotNumber(string value, string paramName, string message, NumberStyles styles, IFormatProvider provider)
    Parameters
    Type Name Description
    System.String value

    The value to be evaluated.

    System.String paramName

    The name of the parameter that caused the exception.

    System.String message

    A message that describes the error.

    System.Globalization.NumberStyles styles

    A bitwise combination of System.Globalization.NumberStyles values that indicates the permitted format of value.

    System.IFormatProvider provider

    An System.IFormatProvider that supplies culture-specific formatting information about value.

    Exceptions
    Type Condition
    System.ArgumentException

    value must be a number.

    | Improve this Doc

    ThrowIfNotSame<T>(T, T, String)

    Validates and throws an System.ArgumentOutOfRangeException if the specified x object are not of the same instance as the y object.

    Declaration
    public static void ThrowIfNotSame<T>(T x, T y, string paramName)
    Parameters
    Type Name Description
    T x

    The first object to compare.

    T y

    The second object to compare.

    System.String paramName

    The name of the parameter that caused the exception.

    Type Parameters
    Name Description
    T

    The type of objects to compare.

    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    x and y are of the same instance.

    | Improve this Doc

    ThrowIfNotSame<T>(T, T, String, String)

    Validates and throws an System.ArgumentOutOfRangeException if the specified x object are not of the same instance as the y object.

    Declaration
    public static void ThrowIfNotSame<T>(T x, T y, string paramName, string message)
    Parameters
    Type Name Description
    T x

    The first object to compare.

    T y

    The second object to compare.

    System.String paramName

    The name of the parameter that caused the exception.

    System.String message

    A message that describes the error.

    Type Parameters
    Name Description
    T

    The type of objects to compare.

    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    x and y are not of the same instance.

    | Improve this Doc

    ThrowIfNotUri(String, String)

    Validates and throws an System.ArgumentException if the specified value does not have the format of an System.Uri.

    Declaration
    public static void ThrowIfNotUri(string value, string paramName)
    Parameters
    Type Name Description
    System.String value

    The value to be evaluated.

    System.String paramName

    The name of the parameter that caused the exception.

    Exceptions
    Type Condition
    System.ArgumentException

    value must be an System.Uri.

    | Improve this Doc

    ThrowIfNotUri(String, UriKind, String, String)

    Validates and throws an System.ArgumentException if the specified value does not have the format of an System.Uri.

    Declaration
    public static void ThrowIfNotUri(string value, UriKind uriKind, string paramName, string message = "Value must be an URI.")
    Parameters
    Type Name Description
    System.String value

    The value to be evaluated.

    System.UriKind uriKind

    The type of the URI.

    System.String paramName

    The name of the parameter that caused the exception.

    System.String message

    A message that describes the error.

    Exceptions
    Type Condition
    System.ArgumentException

    value must be an System.Uri.

    | Improve this Doc

    ThrowIfNull<T>(T, String)

    Validates and throws an System.ArgumentNullException if the specified value is null.

    Declaration
    public static void ThrowIfNull<T>(T value, string paramName)
    Parameters
    Type Name Description
    T value

    The value to be evaluated.

    System.String paramName

    The name of the parameter that caused the exception.

    Type Parameters
    Name Description
    T
    Exceptions
    Type Condition
    System.ArgumentNullException

    value cannot be null.

    | Improve this Doc

    ThrowIfNull<T>(T, String, String)

    Validates and throws an System.ArgumentNullException if the specified value is null.

    Declaration
    public static void ThrowIfNull<T>(T value, string paramName, string message)
    Parameters
    Type Name Description
    T value

    The value to be evaluated.

    System.String paramName

    The name of the parameter that caused the exception.

    System.String message

    A message that describes the error.

    Type Parameters
    Name Description
    T
    Exceptions
    Type Condition
    System.ArgumentNullException

    value cannot be null.

    | Improve this Doc

    ThrowIfNullOrEmpty(String, String)

    Validates and throws either an System.ArgumentNullException or ArgumentEmptyException if the specified value is respectively null or empty.

    Declaration
    public static void ThrowIfNullOrEmpty(string value, string paramName)
    Parameters
    Type Name Description
    System.String value

    The value to be evaluated.

    System.String paramName

    The name of the parameter that caused the exception.

    Exceptions
    Type Condition
    System.ArgumentNullException

    value cannot be null.

    ArgumentEmptyException

    value cannot be empty.

    | Improve this Doc

    ThrowIfNullOrEmpty(String, String, String)

    Validates and throws either an System.ArgumentNullException or ArgumentEmptyException if the specified value is respectively null or empty.

    Declaration
    public static void ThrowIfNullOrEmpty(string value, string paramName, string message)
    Parameters
    Type Name Description
    System.String value

    The value to be evaluated.

    System.String paramName

    The name of the parameter that caused the exception.

    System.String message

    A message that describes the error.

    Exceptions
    Type Condition
    System.ArgumentNullException

    value cannot be null.

    ArgumentEmptyException

    value cannot be empty.

    | Improve this Doc

    ThrowIfNullOrWhitespace(String, String)

    Validates and throws either an System.ArgumentNullException, ArgumentEmptyException or System.ArgumentException if the specified value is respectively null, empty or consist only of white-space characters.

    Declaration
    public static void ThrowIfNullOrWhitespace(string value, string paramName)
    Parameters
    Type Name Description
    System.String value

    The value to be evaluated.

    System.String paramName

    The name of the parameter that caused the exception.

    Exceptions
    Type Condition
    System.ArgumentNullException

    value cannot be null.

    ArgumentEmptyException

    value cannot be empty.

    System.ArgumentException

    value cannot consist only of white-space characters.

    | Improve this Doc

    ThrowIfNullOrWhitespace(String, String, String)

    Validates and throws either an System.ArgumentNullException, ArgumentEmptyException or System.ArgumentException if the specified value is respectively null, empty or consist only of white-space characters.

    Declaration
    public static void ThrowIfNullOrWhitespace(string value, string paramName, string message)
    Parameters
    Type Name Description
    System.String value

    The value to be evaluated.

    System.String paramName

    The name of the parameter that caused the exception.

    System.String message

    A message that describes the error.

    Exceptions
    Type Condition
    System.ArgumentNullException

    value cannot be null.

    ArgumentEmptyException

    value cannot be empty.

    System.ArgumentException

    value cannot consist only of white-space characters.

    | Improve this Doc

    ThrowIfNumber(String, String)

    Validates and throws an System.ArgumentException if the specified value is a number.

    Declaration
    public static void ThrowIfNumber(string value, string paramName)
    Parameters
    Type Name Description
    System.String value

    The value to be evaluated.

    System.String paramName

    The name of the parameter that caused the exception.

    Exceptions
    Type Condition
    System.ArgumentException

    value cannot be a number.

    | Improve this Doc

    ThrowIfNumber(String, String, NumberStyles)

    Validates and throws an System.ArgumentException if the specified value is a number.

    Declaration
    public static void ThrowIfNumber(string value, string paramName, NumberStyles styles)
    Parameters
    Type Name Description
    System.String value

    The value to be evaluated.

    System.String paramName

    The name of the parameter that caused the exception.

    System.Globalization.NumberStyles styles

    A bitwise combination of System.Globalization.NumberStyles values that indicates the permitted format of value.

    Exceptions
    Type Condition
    System.ArgumentException

    value cannot be a number.

    | Improve this Doc

    ThrowIfNumber(String, String, NumberStyles, IFormatProvider)

    Validates and throws an System.ArgumentException if the specified value is a number.

    Declaration
    public static void ThrowIfNumber(string value, string paramName, NumberStyles styles, IFormatProvider provider)
    Parameters
    Type Name Description
    System.String value

    The value to be evaluated.

    System.String paramName

    The name of the parameter that caused the exception.

    System.Globalization.NumberStyles styles

    A bitwise combination of System.Globalization.NumberStyles values that indicates the permitted format of value.

    System.IFormatProvider provider

    An System.IFormatProvider that supplies culture-specific formatting information about value.

    Exceptions
    Type Condition
    System.ArgumentException

    value cannot be a number.

    | Improve this Doc

    ThrowIfNumber(String, String, String)

    Validates and throws an System.ArgumentException if the specified value is a number.

    Declaration
    public static void ThrowIfNumber(string value, string paramName, string message)
    Parameters
    Type Name Description
    System.String value

    The value to be evaluated.

    System.String paramName

    The name of the parameter that caused the exception.

    System.String message

    A message that describes the error.

    Exceptions
    Type Condition
    System.ArgumentException

    value cannot be a number.

    | Improve this Doc

    ThrowIfNumber(String, String, String, NumberStyles)

    Validates and throws an System.ArgumentException if the specified value is a number.

    Declaration
    public static void ThrowIfNumber(string value, string paramName, string message, NumberStyles styles)
    Parameters
    Type Name Description
    System.String value

    The value to be evaluated.

    System.String paramName

    The name of the parameter that caused the exception.

    System.String message

    A message that describes the error.

    System.Globalization.NumberStyles styles

    A bitwise combination of System.Globalization.NumberStyles values that indicates the permitted format of value.

    Exceptions
    Type Condition
    System.ArgumentException

    value cannot be a number.

    | Improve this Doc

    ThrowIfNumber(String, String, String, NumberStyles, IFormatProvider)

    Validates and throws an System.ArgumentException if the specified value is a number.

    Declaration
    public static void ThrowIfNumber(string value, string paramName, string message, NumberStyles styles, IFormatProvider provider)
    Parameters
    Type Name Description
    System.String value

    The value to be evaluated.

    System.String paramName

    The name of the parameter that caused the exception.

    System.String message

    A message that describes the error.

    System.Globalization.NumberStyles styles

    A bitwise combination of System.Globalization.NumberStyles values that indicates the permitted format of value.

    System.IFormatProvider provider

    An System.IFormatProvider that supplies culture-specific formatting information about value.

    Exceptions
    Type Condition
    System.ArgumentException

    value cannot be a number.

    | Improve this Doc

    ThrowIfSame<T>(T, T, String)

    Validates and throws an System.ArgumentOutOfRangeException if the specified x object are of the same instance as the y object.

    Declaration
    public static void ThrowIfSame<T>(T x, T y, string paramName)
    Parameters
    Type Name Description
    T x

    The first object to compare.

    T y

    The second object to compare.

    System.String paramName

    The name of the parameter that caused the exception.

    Type Parameters
    Name Description
    T

    The type of objects to compare.

    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    x and y are not of the same instance.

    | Improve this Doc

    ThrowIfSame<T>(T, T, String, String)

    Validates and throws an System.ArgumentOutOfRangeException if the specified x object are of the same instance as the y object.

    Declaration
    public static void ThrowIfSame<T>(T x, T y, string paramName, string message)
    Parameters
    Type Name Description
    T x

    The first object to compare.

    T y

    The second object to compare.

    System.String paramName

    The name of the parameter that caused the exception.

    System.String message

    A message that describes the error.

    Type Parameters
    Name Description
    T

    The type of objects to compare.

    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    x and y are of the same instance.

    | Improve this Doc

    ThrowIfTrue(Boolean, String)

    Validates and throws an System.ArgumentException if the specified value is true.

    Declaration
    public static void ThrowIfTrue(bool value, string paramName)
    Parameters
    Type Name Description
    System.Boolean value

    The value to be evaluated.

    System.String paramName

    The name of the parameter that caused the exception.

    Exceptions
    Type Condition
    System.ArgumentException

    value must be false.

    | Improve this Doc

    ThrowIfTrue(Boolean, String, String)

    Validates and throws an System.ArgumentException if the specified value is true.

    Declaration
    public static void ThrowIfTrue(bool value, string paramName, string message)
    Parameters
    Type Name Description
    System.Boolean value

    The value to be evaluated.

    System.String paramName

    The name of the parameter that caused the exception.

    System.String message

    A message that describes the error.

    Exceptions
    Type Condition
    System.ArgumentException

    value must be false.

    | Improve this Doc

    ThrowIfUri(String, String)

    Validates and throws an System.ArgumentException if the specified value has the format of an System.Uri.

    Declaration
    public static void ThrowIfUri(string value, string paramName)
    Parameters
    Type Name Description
    System.String value

    The value to be evaluated.

    System.String paramName

    The name of the parameter that caused the exception.

    Exceptions
    Type Condition
    System.ArgumentException

    value cannot be an System.Uri.

    | Improve this Doc

    ThrowIfUri(String, UriKind, String, String)

    Validates and throws an System.ArgumentException if the specified value has the format of an System.Uri.

    Declaration
    public static void ThrowIfUri(string value, UriKind uriKind, string paramName, string message = "Value cannot be an URI.")
    Parameters
    Type Name Description
    System.String value

    The value to be evaluated.

    System.UriKind uriKind

    The type of the URI.

    System.String paramName

    The name of the parameter that caused the exception.

    System.String message

    A message that describes the error.

    Exceptions
    Type Condition
    System.ArgumentException

    value cannot be an System.Uri.

    | Improve this Doc

    ThrowIfWhiteSpace(String, String)

    Validates and throws an ArgumentEmptyException if the specified value consist only of white-space characters.

    Declaration
    public static void ThrowIfWhiteSpace(string value, string paramName)
    Parameters
    Type Name Description
    System.String value

    The value to be evaluated.

    System.String paramName

    The name of the parameter that caused the exception.

    Exceptions
    Type Condition
    System.ArgumentException

    value cannot consist only of white-space characters.

    | Improve this Doc

    ThrowIfWhiteSpace(String, String, String)

    Validates and throws an System.ArgumentException if the specified value consist only of white-space characters.

    Declaration
    public static void ThrowIfWhiteSpace(string value, string paramName, string message)
    Parameters
    Type Name Description
    System.String value

    The value to be evaluated.

    System.String paramName

    The name of the parameter that caused the exception.

    System.String message

    A message that describes the error.

    Exceptions
    Type Condition
    System.ArgumentException

    value cannot consist only of white-space characters.

    • Improve this Doc
    • View Source
    In This Article
    • Methods
      • ThrowIf(Func<Boolean>, Func<String, String, Exception>, String, String)
      • ThrowIf<TValue>(TValue, Func<TValue, Boolean>, Func<String, String, Exception>, String, String)
      • ThrowIf<TValue, T>(TValue, Func<TValue, T, Boolean>, T, Func<String, String, Exception>, String, String)
      • ThrowIf<TValue, T1, T2>(TValue, Func<TValue, T1, T2, Boolean>, T1, T2, Func<String, String, Exception>, String, String)
      • ThrowIf<TValue, T1, T2, T3>(TValue, Func<TValue, T1, T2, T3, Boolean>, T1, T2, T3, Func<String, String, Exception>, String, String)
      • ThrowIf<TValue, T1, T2, T3, T4>(TValue, Func<TValue, T1, T2, T3, T4, Boolean>, T1, T2, T3, T4, Func<String, String, Exception>, String, String)
      • ThrowIf<TValue, T1, T2, T3, T4, T5>(TValue, Func<TValue, T1, T2, T3, T4, T5, Boolean>, T1, T2, T3, T4, T5, Func<String, String, Exception>, String, String)
      • ThrowIfContainsType(Object, String, String, Type[])
      • ThrowIfContainsType(Object, String, Type[])
      • ThrowIfContainsType(Type, String, String, Type[])
      • ThrowIfContainsType(Type, String, Type[])
      • ThrowIfContainsType<T>(String, String, Type[])
      • ThrowIfContainsType<T>(String, Type[])
      • ThrowIfDistinctDifference(String, String, String, String)
      • ThrowIfEmailAddress(String, String)
      • ThrowIfEmailAddress(String, String, String)
      • ThrowIfEmpty(String, String)
      • ThrowIfEmpty(String, String, String)
      • ThrowIfEnum<TEnum>(String, Boolean, String)
      • ThrowIfEnum<TEnum>(String, Boolean, String, String)
      • ThrowIfEnum<TEnum>(String, String)
      • ThrowIfEnumType<TEnum>(String)
      • ThrowIfEnumType<TEnum>(String, String)
      • ThrowIfEqual<T>(T, T, IEqualityComparer<T>, String)
      • ThrowIfEqual<T>(T, T, IEqualityComparer<T>, String, String)
      • ThrowIfEqual<T>(T, T, String)
      • ThrowIfEqual<T>(T, T, String, String)
      • ThrowIfFalse(Boolean, String)
      • ThrowIfFalse(Boolean, String, String)
      • ThrowIfGreaterThan<T>(T, T, String)
      • ThrowIfGreaterThan<T>(T, T, String, String)
      • ThrowIfGreaterThanOrEqual<T>(T, T, String)
      • ThrowIfGreaterThanOrEqual<T>(T, T, String, String)
      • ThrowIfGuid(String, GuidFormats, String)
      • ThrowIfGuid(String, GuidFormats, String, String)
      • ThrowIfGuid(String, String)
      • ThrowIfHex(String, String)
      • ThrowIfHex(String, String, String)
      • ThrowIfLowerThan<T>(T, T, String)
      • ThrowIfLowerThan<T>(T, T, String, String)
      • ThrowIfLowerThanOrEqual<T>(T, T, String)
      • ThrowIfLowerThanOrEqual<T>(T, T, String, String)
      • ThrowIfNot(Func<Boolean>, Func<String, String, Exception>, String, String)
      • ThrowIfNot<TValue>(TValue, Func<TValue, Boolean>, Func<String, String, Exception>, String, String)
      • ThrowIfNot<TValue, T>(TValue, Func<TValue, T, Boolean>, T, Func<String, String, Exception>, String, String)
      • ThrowIfNot<TValue, T1, T2>(TValue, Func<TValue, T1, T2, Boolean>, T1, T2, Func<String, String, Exception>, String, String)
      • ThrowIfNot<TValue, T1, T2, T3>(TValue, Func<TValue, T1, T2, T3, Boolean>, T1, T2, T3, Func<String, String, Exception>, String, String)
      • ThrowIfNot<TValue, T1, T2, T3, T4>(TValue, Func<TValue, T1, T2, T3, T4, Boolean>, T1, T2, T3, T4, Func<String, String, Exception>, String, String)
      • ThrowIfNot<TValue, T1, T2, T3, T4, T5>(TValue, Func<TValue, T1, T2, T3, T4, T5, Boolean>, T1, T2, T3, T4, T5, Func<String, String, Exception>, String, String)
      • ThrowIfNotContainsType(Object, String, String, Type[])
      • ThrowIfNotContainsType(Object, String, Type[])
      • ThrowIfNotContainsType(Type, String, String, Type[])
      • ThrowIfNotContainsType(Type, String, Type[])
      • ThrowIfNotContainsType<T>(String, String, Type[])
      • ThrowIfNotContainsType<T>(String, Type[])
      • ThrowIfNotDistinctDifference(String, String, String, String)
      • ThrowIfNotEmailAddress(String, String)
      • ThrowIfNotEmailAddress(String, String, String)
      • ThrowIfNotEnum<TEnum>(String, Boolean, String)
      • ThrowIfNotEnum<TEnum>(String, Boolean, String, String)
      • ThrowIfNotEnum<TEnum>(String, String)
      • ThrowIfNotEnumType<TEnum>(String)
      • ThrowIfNotEnumType<TEnum>(String, String)
      • ThrowIfNotEqual<T>(T, T, IEqualityComparer<T>, String)
      • ThrowIfNotEqual<T>(T, T, IEqualityComparer<T>, String, String)
      • ThrowIfNotEqual<T>(T, T, String)
      • ThrowIfNotEqual<T>(T, T, String, String)
      • ThrowIfNotGuid(String, GuidFormats, String)
      • ThrowIfNotGuid(String, GuidFormats, String, String)
      • ThrowIfNotGuid(String, String)
      • ThrowIfNotHex(String, String)
      • ThrowIfNotHex(String, String, String)
      • ThrowIfNotNumber(String, String)
      • ThrowIfNotNumber(String, String, NumberStyles)
      • ThrowIfNotNumber(String, String, NumberStyles, IFormatProvider)
      • ThrowIfNotNumber(String, String, String)
      • ThrowIfNotNumber(String, String, String, NumberStyles)
      • ThrowIfNotNumber(String, String, String, NumberStyles, IFormatProvider)
      • ThrowIfNotSame<T>(T, T, String)
      • ThrowIfNotSame<T>(T, T, String, String)
      • ThrowIfNotUri(String, String)
      • ThrowIfNotUri(String, UriKind, String, String)
      • ThrowIfNull<T>(T, String)
      • ThrowIfNull<T>(T, String, String)
      • ThrowIfNullOrEmpty(String, String)
      • ThrowIfNullOrEmpty(String, String, String)
      • ThrowIfNullOrWhitespace(String, String)
      • ThrowIfNullOrWhitespace(String, String, String)
      • ThrowIfNumber(String, String)
      • ThrowIfNumber(String, String, NumberStyles)
      • ThrowIfNumber(String, String, NumberStyles, IFormatProvider)
      • ThrowIfNumber(String, String, String)
      • ThrowIfNumber(String, String, String, NumberStyles)
      • ThrowIfNumber(String, String, String, NumberStyles, IFormatProvider)
      • ThrowIfSame<T>(T, T, String)
      • ThrowIfSame<T>(T, T, String, String)
      • ThrowIfTrue(Boolean, String)
      • ThrowIfTrue(Boolean, String, String)
      • ThrowIfUri(String, String)
      • ThrowIfUri(String, UriKind, String, String)
      • ThrowIfWhiteSpace(String, String)
      • ThrowIfWhiteSpace(String, String, String)
    Back to top Copyright 2008-2018 Weubphoria. All rights reserved.
    Generated by DocFX