public class FormatException : SystemException
Object
Exception
SystemException
FormatException
mscorlib
BCL
Represents errors caused by passing incorrectly formatted arguments or invalid format specifiers to methods.
[Note: FormatException is thrown fromParse
methods when a String being parsed contains characters that are not valid according to the specified style (passed via the style parameter) or default style. FormatException is thrown fromToString
methods when a format specifier (passed via the format parameter) is not a valid format for the type of the current instance.]
System Namespace
FormatException Constructors
FormatException() Constructor
FormatException(System.String) Constructor
FormatException(System.String, System.Exception) Constructor
public FormatException();
Constructs and initializes a new instance of the FormatException class.
This constructor initializes the System.FormatException.Message property of the new instance to a system-supplied message that describes the error, such as "Invalid format." This message takes into account the current system culture. The System.FormatException.InnerException property is initialized tonull
.
System.FormatException Class, System Namespace
public FormatException(string message);
Constructs and initializes a new instance of the FormatException class.
- message
- A String that describes the error. The content of message is intended to be understood by humans. The caller of this constructor is required to ensure that this string has been localized for the current system culture.
This constructor initializes the System.FormatException.Message property of the new instance using message . If message isnull
, the System.FormatException.Message property is initialized to the system-supplied message provided by the constructor that takes no arguments.The System.FormatException.InnerException property is initialized to
null
.
System.FormatException Class, System Namespace
public FormatException(string message, Exception innerException);
Constructs and initializes a new instance of the FormatException class.
- message
- A String that describes the error. The content of message is intended to be understood by humans. The caller of this constructor is required to ensure that this string has been localized for the current system culture.
- innerException
- An instance of Exception that is the cause of the current exception. If innerException is non-null, then the current exception was raised in a catch block handling innerException .
This constructor initializes the System.FormatException.Message property of the new instance using message , and the System.FormatException.InnerException property using innerException. If message isnull
, the System.FormatException.Message property is initialized to the system-supplied message provided by the constructor that takes no arguments.[Note: For information on inner exceptions, see System.Exception.InnerException .]
System.FormatException Class, System Namespace