語言

AppDomainSetup.GetConfigurationBytes 方法

定義

回傳方法 SetConfigurationBytes(Byte[]) 所設定的 XML 設定資訊,覆蓋應用程式的 XML 設定資訊。

public:
 cli::array <System::Byte> ^ GetConfigurationBytes();
public byte[] GetConfigurationBytes();
member this.GetConfigurationBytes : unit -> byte[]
Public Function GetConfigurationBytes () As Byte()

傳回

Byte[]

一個陣列,包含由該方法設定的 SetConfigurationBytes(Byte[]) XML 配置資訊,或 null 若 SetConfigurationBytes(Byte[]) 該方法尚未被呼叫。

備註

此 SetConfigurationBytes 方法提供一種覆寫應用程式設定資訊的方法,該設定資訊會建立新的應用程式域。 設定 value 檔資訊會覆蓋應用程式的設定檔資訊。 例如,當 Example.exe 應用程式建立新的應用程式域時,它可以覆寫原本從 Example.exe.config 檔案取得的設定資訊。

Important

部分設定檔資訊的使用者並未使用該方法所 SetConfigurationBytes 儲存的資訊。 執行時間並不強制執行這點。 為了確保所有組態檔案資訊在新的應用程式域中都被覆寫,請使用該 ConfigurationFile 屬性指定一個組態檔案。 這個 SetConfigurationBytes 方法確實會影響組裝裝訂。

XML 中的 value XML 與一般設定檔中的 XML 相同,只是以陣列形式儲存 Byte 。

要存取應用程式域的組態位元組,請使用 AppDomain.SetupInformation 該屬性取得 AppDomainSetup 該應用程式域的物件,然後使用該 GetConfigurationBytes 方法。

適用於