TypeAccessException Constructors

Definition

Initializes a new instance of the TypeAccessException class.

Overloads

TypeAccessException()

Initializes a new instance of the TypeAccessException class with a system-supplied message that describes the error.

TypeAccessException(String)

Initializes a new instance of the TypeAccessException class with a specified message that describes the error.

TypeAccessException(SerializationInfo, StreamingContext)

Initializes a new instance of the TypeAccessException class with serialized data.

TypeAccessException(String, Exception)

Initializes a new instance of the TypeAccessException class with a specified error message and a reference to the inner exception that is the cause of this exception.

TypeAccessException()

Initializes a new instance of the TypeAccessException class with a system-supplied message that describes the error.

public:
 TypeAccessException();
public TypeAccessException ();
Public Sub New ()

Remarks

This constructor initializes the Message property of the new instance to a system-supplied message that describes the error, such as "Attempt to access the type failed." This message takes the current system culture into account.

The following table shows the initial property values for an instance of TypeAccessException.

Property Value
InnerException A null reference (Nothing in Visual Basic).
Message The localized error message string.

See also

TypeAccessException(String)

Initializes a new instance of the TypeAccessException class with a specified message that describes the error.

public:
 TypeAccessException(System::String ^ message);
public TypeAccessException (string message);
new TypeAccessException : string -> TypeAccessException
Public Sub New (message As String)

Parameters

message
String

The message that describes the exception. The caller of this constructor must ensure that this string has been localized for the current system culture.

Remarks

The following table shows the initial property values for an instance of TypeAccessException.

Property Value
InnerException A null reference (Nothing in Visual Basic).
Message The error message string specified in message.

See also

TypeAccessException(SerializationInfo, StreamingContext)

Initializes a new instance of the TypeAccessException class with serialized data.

protected:
 TypeAccessException(System::Runtime::Serialization::SerializationInfo ^ info, System::Runtime::Serialization::StreamingContext context);
protected TypeAccessException (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
new TypeAccessException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> TypeAccessException
Protected Sub New (info As SerializationInfo, context As StreamingContext)

Parameters

info
SerializationInfo

The object that holds the serialized data.

context
StreamingContext

The contextual information about the source or destination.

Remarks

This constructor is called during deserialization to reconstitute the exception object that was transmitted over a stream. For more information, see XML and SOAP Serialization.

See also

TypeAccessException(String, Exception)

Initializes a new instance of the TypeAccessException class with a specified error message and a reference to the inner exception that is the cause of this exception.

public:
 TypeAccessException(System::String ^ message, Exception ^ inner);
public TypeAccessException (string message, Exception inner);
new TypeAccessException : string * Exception -> TypeAccessException
Public Sub New (message As String, inner As Exception)

Parameters

message
String

The message that describes the exception. The caller of this constructor must ensure that this string has been localized for the current system culture.

inner
Exception

The exception that is the cause of the current exception. If the inner parameter is not null, the current exception is raised in a catch block that handles the inner exception.

Remarks

An exception that is thrown as a direct result of a previous exception should include a reference to the previous exception in the InnerException property. The InnerException property returns the same value that is passed into the constructor, or null if the InnerException property does not supply the inner exception value to the constructor.

The following table shows the initial property values for an instance of TypeAccessException.

Property Value
InnerException A null reference (Nothing in Visual Basic).
Message The error message string specified in message.

See also

Applies to