FieldAccessException Constructors
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Initializes a new instance of the FieldAccessException class.
Overloads
FieldAccessException() |
Initializes a new instance of the FieldAccessException class. |
FieldAccessException(String) |
Initializes a new instance of the FieldAccessException class with a specified error message. |
FieldAccessException(SerializationInfo, StreamingContext) |
Obsolete.
Initializes a new instance of the FieldAccessException class with serialized data. |
FieldAccessException(String, Exception) |
Initializes a new instance of the FieldAccessException class with a specified error message and a reference to the inner exception that is the cause of this exception. |
FieldAccessException()
- Source:
- FieldAccessException.cs
- Source:
- FieldAccessException.cs
- Source:
- FieldAccessException.cs
Initializes a new instance of the FieldAccessException class.
public:
FieldAccessException();
public FieldAccessException ();
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 "Attempted to access a field that is not accessible by the caller." This message takes the current system culture into account.
The following table shows the initial property values for an instance of FieldAccessException.
Property | Value |
---|---|
InnerException | A null reference (Nothing in Visual Basic). |
Message | The localized error message string. |
Applies to
FieldAccessException(String)
- Source:
- FieldAccessException.cs
- Source:
- FieldAccessException.cs
- Source:
- FieldAccessException.cs
Initializes a new instance of the FieldAccessException class with a specified error message.
public:
FieldAccessException(System::String ^ message);
public FieldAccessException (string message);
public FieldAccessException (string? message);
new FieldAccessException : string -> FieldAccessException
Public Sub New (message As String)
Parameters
- message
- String
The error message that explains the reason for the exception.
Remarks
This constructor initializes the Message property of the new instance by using the message
parameter. The content of message
is intended to be understood by humans. The caller of this constructor must ensure that this string has been localized for the current system culture.
The following table shows the initial property values for an instance of FieldAccessException.
Property | Value |
---|---|
InnerException | A null reference (Nothing in Visual Basic). |
Message | The localized error message string. |
Applies to
FieldAccessException(SerializationInfo, StreamingContext)
- Source:
- FieldAccessException.cs
- Source:
- FieldAccessException.cs
- Source:
- FieldAccessException.cs
Caution
This API supports obsolete formatter-based serialization. It should not be called or extended by application code.
Initializes a new instance of the FieldAccessException class with serialized data.
protected:
FieldAccessException(System::Runtime::Serialization::SerializationInfo ^ info, System::Runtime::Serialization::StreamingContext context);
protected FieldAccessException (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
[System.Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.", DiagnosticId="SYSLIB0051", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
protected FieldAccessException (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
new FieldAccessException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> FieldAccessException
[<System.Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.", DiagnosticId="SYSLIB0051", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
new FieldAccessException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> FieldAccessException
Protected Sub New (info As SerializationInfo, context As StreamingContext)
Parameters
- info
- SerializationInfo
The object that holds the serialized object data.
- context
- StreamingContext
The contextual information about the source or destination.
- Attributes
Remarks
This constructor is called during deserialization to reconstitute the exception object that was transmitted over a stream.
Applies to
FieldAccessException(String, Exception)
- Source:
- FieldAccessException.cs
- Source:
- FieldAccessException.cs
- Source:
- FieldAccessException.cs
Initializes a new instance of the FieldAccessException class with a specified error message and a reference to the inner exception that is the cause of this exception.
public:
FieldAccessException(System::String ^ message, Exception ^ inner);
public FieldAccessException (string message, Exception inner);
public FieldAccessException (string? message, Exception? inner);
new FieldAccessException : string * Exception -> FieldAccessException
Public Sub New (message As String, inner As Exception)
Parameters
- message
- String
The error message that explains the reason for the exception.
- 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 returns null
if it does not supply the inner exception value to the constructor. The caller of this constructor must ensure that this string has been localized for the current system culture.
The following table shows the initial property values for an instance of FieldAccessException.
Property | Value |
---|---|
InnerException | The inner exception reference. |
Message | The localized error message string. |