語言

UnauthorizedAccessException 建構函式

定義

初始化 UnauthorizedAccessException 類別的新執行個體。

多載

名稱 Description
UnauthorizedAccessException()

初始化 UnauthorizedAccessException 類別的新執行個體。

UnauthorizedAccessException(String)

使用指定的錯誤訊息,初始化 UnauthorizedAccessException 類別的新實例。

UnauthorizedAccessException(SerializationInfo, StreamingContext)
已淘汰.

初始化一個新的類別實例 UnauthorizedAccessException ,並使用序列化資料。

UnauthorizedAccessException(String, Exception)

初始化類別的新實例 UnauthorizedAccessException ,並附上指定的錯誤訊息及導致該異常的內部例外的參考。

UnauthorizedAccessException()

來源:
UnauthorizedAccessException.cs
來源:
UnauthorizedAccessException.cs
來源:
UnauthorizedAccessException.cs
來源:
UnauthorizedAccessException.cs
來源:
UnauthorizedAccessException.cs

初始化 UnauthorizedAccessException 類別的新執行個體。

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

備註

此建構子會將新實例的屬性初始 Message 化為系統提供的訊息,描述錯誤,例如「嘗試執行未授權操作」。此訊息考量了當前系統文化。

下表顯示了 的 MemberAccessException初始屬性值。

房產 價值觀
InnerException 一個空參考(Nothing Visual Basic 中的 Reference)。
Message 區域化錯誤訊息字串。

適用於

UnauthorizedAccessException(String)

來源:
UnauthorizedAccessException.cs
來源:
UnauthorizedAccessException.cs
來源:
UnauthorizedAccessException.cs
來源:
UnauthorizedAccessException.cs
來源:
UnauthorizedAccessException.cs

使用指定的錯誤訊息,初始化 UnauthorizedAccessException 類別的新實例。

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

參數

message
String

描述錯誤的訊息。

備註

參數的內容 message 應該能讓使用者理解。 此建構器的呼叫者必須確保此字串已在目前系統文化中本地化。

下表顯示了 的 UnauthorizedAccessException初始屬性值。

房產 價值觀
InnerException 一個空參考(Nothing Visual Basic 中的 Reference)。
Message 錯誤訊息字串。

適用於

UnauthorizedAccessException(SerializationInfo, StreamingContext)

來源:
UnauthorizedAccessException.cs
來源:
UnauthorizedAccessException.cs
來源:
UnauthorizedAccessException.cs
來源:
UnauthorizedAccessException.cs
來源:
UnauthorizedAccessException.cs

警告

This API supports obsolete formatter-based serialization. It should not be called or extended by application code.

初始化一個新的類別實例 UnauthorizedAccessException ,並使用序列化資料。

protected:
 UnauthorizedAccessException(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 UnauthorizedAccessException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
protected UnauthorizedAccessException(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}")>]
new UnauthorizedAccessException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> UnauthorizedAccessException
new UnauthorizedAccessException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> UnauthorizedAccessException
Protected Sub New (info As SerializationInfo, context As StreamingContext)

參數

info
SerializationInfo

那 SerializationInfo 個 保留了關於被拋出例外的序列化物件資料。

context
StreamingContext

the that StreamingContext 包含了關於來源或目的地的上下文資訊。

屬性

適用於

UnauthorizedAccessException(String, Exception)

來源:
UnauthorizedAccessException.cs
來源:
UnauthorizedAccessException.cs
來源:
UnauthorizedAccessException.cs
來源:
UnauthorizedAccessException.cs
來源:
UnauthorizedAccessException.cs

初始化類別的新實例 UnauthorizedAccessException ,並附上指定的錯誤訊息及導致該異常的內部例外的參考。

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

參數

message
String

說明例外狀況原因的錯誤訊息。

inner
Exception

該例外即為當前例外的原因。 如果參數 inner 不是 null 參考(Nothing 在 Visual Basic 中),當前例外會在處理內部例外的區塊中被提出 catch 。

備註

因先前例外直接拋出的例外,應包含對該屬性中 InnerException 先前例外的參考。 該InnerException屬性會回傳與傳入建構子相同的值,或若該Nothing屬性未提供內建器內部例外值,則回傳 Visual Basic 中的空參考InnerException。

下表顯示了 的 UnauthorizedAccessException初始屬性值。

房產 價值觀
InnerException 內部例外的參考。
Message 錯誤訊息字串。

適用於