AppDomainSetup.GetConfigurationBytes AppDomainSetup.GetConfigurationBytes AppDomainSetup.GetConfigurationBytes AppDomainSetup.GetConfigurationBytes Method

定义

返回由 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.

重要

配置文件信息的一些使用者不使用存储的信息SetConfigurationBytes方法。Some 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.

中的 XMLvalue是在常规配置文件中,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.

适用于