Exportar (0) Imprimir
Expandir Tudo
Este artigo foi traduzido por máquina. Coloque o ponteiro do mouse sobre as frases do artigo para ver o texto original. Mais informações.
Tradução
Original

AppDomain.CreateInstance Método (String, String, Boolean, BindingFlags, Binder, Object[], CultureInfo, Object[], Evidence)

Creates a Novo of the specified defined in the specified assembly.Os parâmetros especificam um fichário, Sinalizadores de ligação, argumentos de construtor, informações de cultura-específicas usadas para interpretar argumentos, Atributos de ativação e a autorização para criar o tipo.

Namespace:  System
Assembly:  mscorlib (em mscorlib. dll)

public ObjectHandle CreateInstance(
	string assemblyName,
	string typeName,
	bool ignoreCase,
	BindingFlags bindingAttr,
	Binder binder,
	Object[] args,
	CultureInfo culture,
	Object[] activationAttributes,
	Evidence securityAttributes
)

Parâmetros

assemblyName
Tipo: System.String
The Exibir name of the assembly.See Assembly.FullName.
typeName
Tipo: System.String
The fully qualified name of the requested type, including the namespace but not the assembly, as returned by the Type.FullName property.
ignoreCase
Tipo: System.Boolean
Um Boolean valor especificando se deseja executar um maiúscminúsc-confidencial pesquisa ou não.
bindingAttr
Tipo: System.Reflection.BindingFlags
A combination of zero or more bit flags that affect the search for the typeName constructor.If bindingAttr is zero, a case-sensitive search for public constructors is conducted.
binder
Tipo: System.Reflection.Binder
An object that enables the binding, coercion of argument types, invocation of members, and retrieval of MemberInfo objects using reflection.If binder is null, the default binder is used.
args
Tipo: System.Object[]
Os argumentos para passar para o construtor.Essa matriz de argumentos deve corresponder em número, ordem e tipo de Parâmetros do construtor para invocar.If the default constructor is preferred, args must be an empty array or null.
culture
Tipo: System.Globalization.CultureInfo
Culture-specific information that governs the coercion of args to the formal types declared for the typeName constructor.If culture is null, the CultureInfo for the current thread is used.
activationAttributes
Tipo: System.Object[]
Uma matriz de um ou mais atributos que podem participar de ativação.Typically, an array that contains a single UrlAttribute object.The UrlAttribute specifies the URL that is required to activate a remote object.For a detailed description of client-activated objects, see Activation Cliente.
securityAttributes
Tipo: System.Security.Policy.Evidence
Information used to authorize creation of typeName.

Valor de retorno

Tipo: System.Runtime.Remoting.ObjectHandle
An object that is a wrapper for the new instance specified by typeName.O valor de retorno precisa ser unwrapped para acessar o objeto real.

Implementa

_AppDomain.CreateInstance(String, String, Boolean, BindingFlags, Binder, Object[], CultureInfo, Object[], Evidence)

ExceçãoCondição
AppDomainUnloadedException

Operações são tentadas em um domínio de aplicativo descarregado.

ArgumentNullException

assemblyName or typeName is null.

BadImageFormatException

assemblyName is not a valid assembly.

-ou-

Version 2.0 or later of the common language runtime is currently loaded and assemblyName was compiled with a later version.

FileLoadException

Um conjunto de módulos (assembly) ou módulo foi carregado duas vezes com dois evidências diferentes.

FileNotFoundException

assemblyName was not found.

MethodAccessException

O chamador não tem permissão para chamar esse construtor.

MissingMethodException

Nenhum construtor correspondente foi encontrado.

NotSupportedException

The caller cannot provide activation attributes for an object that does not inherit from MarshalByRefObject.

TypeLoadException

typename was not found in assemblyName.

NullReferenceException

This instance is null.

This method calls the default constructor for typeName.

See AssemblyName for the format of assemblyName.

An attempt to call CreateInstance on a target application domain that is not the current application domain will result in a successful load of the assembly in the target application domain.Since an Assembly is not MarshalByRefObject, when this method attempts to return the Assembly for the loaded assembly to the current application domain, the common language runtime will try to load the assembly into the current application domain and the load might fail.The assembly that is Loaded into the Might be different from the assembly that was Loaded First If the settings for the two Domínios are different.

Contribuições da comunidade

ADICIONAR
Mostrar:
© 2014 Microsoft