System.FormatException Class

public class FormatException : SystemException

Base Types

Object
  Exception
    SystemException
      FormatException

Assembly

mscorlib

Library

BCL

Summary

Represents errors caused by passing incorrectly formatted arguments or invalid format specifiers to methods.

Description

[Note: FormatException is thrown from Parse 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 from ToString methods when a format specifier (passed via the format parameter) is not a valid format for the type of the current instance.]

See Also

System Namespace

Members

FormatException Constructors

FormatException() Constructor
FormatException(System.String) Constructor
FormatException(System.String, System.Exception) Constructor


FormatException() Constructor

public FormatException();

Summary

Constructs and initializes a new instance of the FormatException class.

Description

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 to null .

See Also

System.FormatException Class, System Namespace

FormatException(System.String) Constructor

public FormatException(string message);

Summary

Constructs and initializes a new instance of the FormatException class.

Parameters

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.

Description

This constructor initializes the System.FormatException.Message property of the new instance using message . If message is null , 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 .

See Also

System.FormatException Class, System Namespace

FormatException(System.String, System.Exception) Constructor

public FormatException(string message, Exception innerException);

Summary

Constructs and initializes a new instance of the FormatException class.

Parameters

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 .

Description

This constructor initializes the System.FormatException.Message property of the new instance using message , and the System.FormatException.InnerException property using innerException. If message is null , 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 .]

See Also

System.FormatException Class, System Namespace