共用方式為


HostProtectionException 建構函式

定義

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

多載

HostProtectionException()

使用預設值,初始化 HostProtectionException 類別的新執行個體。

HostProtectionException(String)

使用指定的錯誤訊息,初始化 HostProtectionException 類別的新執行個體。

HostProtectionException(SerializationInfo, StreamingContext)
已淘汰.

使用提供的序列化資訊和資料流內容,初始化 HostProtectionException 類別的新執行個體。

HostProtectionException(String, Exception)

使用指定的錯誤訊息以及造成此例外狀況的內部例外狀況的參考,初始化 HostProtectionException 類別的新執行個體。

HostProtectionException(String, HostProtectionResource, HostProtectionResource)

使用指定的錯誤訊息、保護的主機資源和導致擲回例外狀況的主機資源,初始化 HostProtectionException 類別的新執行個體。

HostProtectionException()

來源:
HostProtectionException.cs
來源:
HostProtectionException.cs
來源:
HostProtectionException.cs
來源:
HostProtectionException.cs
來源:
HostProtectionException.cs

使用預設值,初始化 HostProtectionException 類別的新執行個體。

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

備註

下表顯示 HostProtectionException 類別執行個體的初始屬性值。

屬性
ProtectedResources HostProtectionResource.None
DemandedResources HostProtectionResource.None

適用於

HostProtectionException(String)

來源:
HostProtectionException.cs
來源:
HostProtectionException.cs
來源:
HostProtectionException.cs
來源:
HostProtectionException.cs
來源:
HostProtectionException.cs

使用指定的錯誤訊息,初始化 HostProtectionException 類別的新執行個體。

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

參數

message
String

描述錯誤的訊息。

備註

參數的內容 message 應該可供使用者瞭解。 需要此建構函式的呼叫者,才能確保此字串已針對目前的系統文化特性進行當地語系化。

適用於

HostProtectionException(SerializationInfo, StreamingContext)

來源:
HostProtectionException.cs
來源:
HostProtectionException.cs
來源:
HostProtectionException.cs
來源:
HostProtectionException.cs
來源:
HostProtectionException.cs

警告

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

使用提供的序列化資訊和資料流內容,初始化 HostProtectionException 類別的新執行個體。

protected:
 HostProtectionException(System::Runtime::Serialization::SerializationInfo ^ info, System::Runtime::Serialization::StreamingContext context);
protected HostProtectionException (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 HostProtectionException (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
new System.Security.HostProtectionException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Security.HostProtectionException
[<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 System.Security.HostProtectionException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Security.HostProtectionException
Protected Sub New (info As SerializationInfo, context As StreamingContext)

參數

info
SerializationInfo

存放序列物件資料的物件。

context
StreamingContext

關於來源或目的端的內容資訊。

屬性

例外狀況

infonull

備註

在還原序列化期間呼叫這個建構函式,以重建在資料流上傳輸的例外狀況物件。

適用於

HostProtectionException(String, Exception)

來源:
HostProtectionException.cs
來源:
HostProtectionException.cs
來源:
HostProtectionException.cs
來源:
HostProtectionException.cs
來源:
HostProtectionException.cs

使用指定的錯誤訊息以及造成此例外狀況的內部例外狀況的參考,初始化 HostProtectionException 類別的新執行個體。

public:
 HostProtectionException(System::String ^ message, Exception ^ e);
public HostProtectionException (string message, Exception e);
new System.Security.HostProtectionException : string * Exception -> System.Security.HostProtectionException
Public Sub New (message As String, e As Exception)

參數

message
String

解釋例外狀況原因的錯誤訊息。

e
Exception

做為目前例外狀況發生原因的例外狀況。 如果 innerException 參數不是 null,則目前的例外狀況會在處理內部例外的 catch 區塊中引發。

備註

直接因為前一個例外狀況而擲回的例外狀況可能包含對 InnerException 屬性中前一個例外狀況的參考。 InnerException 屬性傳回的值會與傳入建構函式的值相同,或傳回 null (如果 InnerException 屬性未提供內部例外狀況值給建構函式)。

適用於

HostProtectionException(String, HostProtectionResource, HostProtectionResource)

來源:
HostProtectionException.cs
來源:
HostProtectionException.cs
來源:
HostProtectionException.cs
來源:
HostProtectionException.cs
來源:
HostProtectionException.cs

使用指定的錯誤訊息、保護的主機資源和導致擲回例外狀況的主機資源,初始化 HostProtectionException 類別的新執行個體。

public:
 HostProtectionException(System::String ^ message, System::Security::Permissions::HostProtectionResource protectedResources, System::Security::Permissions::HostProtectionResource demandedResources);
public HostProtectionException (string message, System.Security.Permissions.HostProtectionResource protectedResources, System.Security.Permissions.HostProtectionResource demandedResources);
new System.Security.HostProtectionException : string * System.Security.Permissions.HostProtectionResource * System.Security.Permissions.HostProtectionResource -> System.Security.HostProtectionException
Public Sub New (message As String, protectedResources As HostProtectionResource, demandedResources As HostProtectionResource)

參數

message
String

解釋例外狀況原因的錯誤訊息。

protectedResources
HostProtectionResource

列舉值的位元組合,指定部分信任程式碼無法存取的主機資源。

demandedResources
HostProtectionResource

列舉值的位元組合,指定需要的主機資源。

備註

參數 demandedResources 會指定導致擲回例外狀況的要求主機保護類別。 例如,假設方法具有屬性 HostProtectionAttribute ,表示方法公開共用狀態。 呼叫 方法時,會 HostProtectionAttribute 執行共用狀態的連結需求。 如果主機已將共用狀態設定為禁止的類別,則會 HostProtectionExceptiondemandedResources 的屬性值 HostProtectionResource.SharedState 引發 。

適用於