AppDomainSetup.GetConfigurationBytes 方法

定義

傳回 SetConfigurationBytes(Byte[]) 方法設定的 XML 組態資訊,此方法會覆寫應用程式的 XML 組態資訊。Returns the XML configuration information set by the SetConfigurationBytes(Byte[]) method, which overrides the application's XML configuration information.

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

傳回

Byte[]

陣列,包含 SetConfigurationBytes(Byte[]) 方法所設定的 XML 組態資訊;如果尚未呼叫 SetConfigurationBytes(Byte[]) 方法,則為 nullAn array that contains the XML configuration information that was set by the SetConfigurationBytes(Byte[]) method, or null if the SetConfigurationBytes(Byte[]) method has not been called.

備註

SetConfigurationBytes方法會提供一種方法來覆寫建立新應用程式域之應用程式的設定資訊。The SetConfigurationBytes method provides a way to override the configuration information of an application that creates a new application domain. 中的設定檔資訊會 value 覆寫應用程式的設定檔資訊。The configuration file information in value overrides the configuration file information for the application. 例如,當 Example.exe 應用程式建立新的應用程式域時,它可以覆寫原先從 Example.exe.config 檔案取得的設定資訊。For example, when the Example.exe application creates a new application domain, it can override the configuration information originally obtained from Example.exe.config file.

重要

設定檔資訊的某些取用者不會使用方法所儲存的資訊 SetConfigurationBytesSome consumers of configuration file information do not use the information stored by the SetConfigurationBytes method. 執行時間不會強制執行此功能。The runtime does not enforce this. 若要確保在新的應用程式域中覆寫所有設定檔資訊,請使用 ConfigurationFile 屬性來指定設定檔。To ensure that all configuration file information is overridden in a new application domain, use the ConfigurationFile property to specify a configuration file. SetConfigurationBytes 方法會影響元件系結。The SetConfigurationBytes method does affect assembly binding.

中的 XML 與 value 一般設定檔中的 xml 相同,不同之處在于它會儲存為 Byte 陣列。The XML in value is the same as the XML in a normal configuration file, except that it is stored as a Byte array.

若要存取應用程式域的設定位元組,請使用 AppDomain.SetupInformation 屬性來取得 AppDomainSetup 應用程式域的物件,然後使用 GetConfigurationBytes 方法。To access the configuration bytes for an application domain, use the AppDomain.SetupInformation property to get the AppDomainSetup object for the application domain, then use the GetConfigurationBytes method.

適用於