System Namespace
Contains methods to create types of objects locally or remotely, or obtain references to existing remote objects.
Visibility |
Name |
Parameters |
Return Type |
public static |
CreateComInstanceFrom |
(
String
assemblyName
,
String
typeName
)
|
ObjectHandle
|
public static |
CreateComInstanceFrom |
(
String
assemblyName
,
String
typeName
,
Byte
hashValue
,
AssemblyHashAlgorithm
hashAlgorithm
)
|
ObjectHandle
|
public static |
CreateInstance |
(
String
assemblyName
,
String
typeName
,
Boolean
ignoreCase
,
BindingFlags
bindingAttr
,
Binder
binder
,
Object
args
,
CultureInfo
culture
,
Object
activationAttributes
)
|
ObjectHandle
|
public static |
CreateInstance |
(
String
assemblyName
,
String
typeName
,
Boolean
ignoreCase
,
BindingFlags
bindingAttr
,
Binder
binder
,
Object
args
,
CultureInfo
culture
,
Object
activationAttributes
,
Evidence
securityInfo
)
|
ObjectHandle
|
public static |
CreateInstance |
(
ActivationContext
activationContext
)
|
ObjectHandle
|
public static |
CreateInstance |
(
ActivationContext
activationContext
,
String
activationCustomData
)
|
ObjectHandle
|
public static |
CreateInstance |
(
AppDomain
domain
,
String
assemblyName
,
String
typeName
,
Boolean
ignoreCase
,
BindingFlags
bindingAttr
,
Binder
binder
,
Object
args
,
CultureInfo
culture
,
Object
activationAttributes
,
Evidence
securityAttributes
)
|
ObjectHandle
|
public static |
CreateInstance |
(
AppDomain
domain
,
String
assemblyName
,
String
typeName
)
|
ObjectHandle
|
public static |
CreateInstance |
(
AppDomain
domain
,
String
assemblyName
,
String
typeName
,
Boolean
ignoreCase
,
BindingFlags
bindingAttr
,
Binder
binder
,
Object
args
,
CultureInfo
culture
,
Object
activationAttributes
)
|
ObjectHandle
|
public static |
CreateInstance |
(
Type
type
,
BindingFlags
bindingAttr
,
Binder
binder
,
Object
args
,
CultureInfo
culture
)
|
Object
|
public static |
CreateInstance |
(
Type
type
,
Object
args
,
Object
activationAttributes
)
|
Object
|
public static |
CreateInstance |
(
Type
type
)
|
Object
|
public static |
CreateInstance |
(
Type
type
,
BindingFlags
bindingAttr
,
Binder
binder
,
Object
args
,
CultureInfo
culture
,
Object
activationAttributes
)
|
Object
|
public static |
CreateInstance |
(
Type
type
,
Object
args
)
|
Object
|
public static |
CreateInstance |
(
Type
type
,
Boolean
nonPublic
)
|
Object
|
public static |
CreateInstance |
( )
|
T
|
public static |
CreateInstance |
(
String
assemblyName
,
String
typeName
)
|
ObjectHandle
|
public static |
CreateInstance |
(
String
assemblyName
,
String
typeName
,
Object
activationAttributes
)
|
ObjectHandle
|
public static |
CreateInstanceFrom |
(
AppDomain
domain
,
String
assemblyFile
,
String
typeName
,
Boolean
ignoreCase
,
BindingFlags
bindingAttr
,
Binder
binder
,
Object
args
,
CultureInfo
culture
,
Object
activationAttributes
)
|
ObjectHandle
|
public static |
CreateInstanceFrom |
(
AppDomain
domain
,
String
assemblyFile
,
String
typeName
,
Boolean
ignoreCase
,
BindingFlags
bindingAttr
,
Binder
binder
,
Object
args
,
CultureInfo
culture
,
Object
activationAttributes
,
Evidence
securityAttributes
)
|
ObjectHandle
|
public static |
CreateInstanceFrom |
(
String
assemblyFile
,
String
typeName
,
Object
activationAttributes
)
|
ObjectHandle
|
public static |
CreateInstanceFrom |
(
String
assemblyFile
,
String
typeName
)
|
ObjectHandle
|
public static |
CreateInstanceFrom |
(
String
assemblyFile
,
String
typeName
,
Boolean
ignoreCase
,
BindingFlags
bindingAttr
,
Binder
binder
,
Object
args
,
CultureInfo
culture
,
Object
activationAttributes
,
Evidence
securityInfo
)
|
ObjectHandle
|
public static |
CreateInstanceFrom |
(
AppDomain
domain
,
String
assemblyFile
,
String
typeName
)
|
ObjectHandle
|
public static |
CreateInstanceFrom |
(
String
assemblyFile
,
String
typeName
,
Boolean
ignoreCase
,
BindingFlags
bindingAttr
,
Binder
binder
,
Object
args
,
CultureInfo
culture
,
Object
activationAttributes
)
|
ObjectHandle
|
public static |
GetObject |
(
Type
type
,
String
url
,
Object
state
)
|
Object
|
public static |
GetObject |
(
Type
type
,
String
url
)
|
Object
|
|
The CreateInstance method creates an instance of a type defined in an assembly by invoking the constructor that best matches the specified arguments. If no arguments are specified then the constructor that takes no parameters, that is, the default constructor, is invoked.
You must have sufficient permission to search for and call a constructor, otherwise and exception is thrown. By default, only public constructors are considered during the search for a constructor. If no constructor or default constructor can be found, an exception is thrown.
A binder parameter specifies an object that searches an assembly for a suitable constructor. You can specify your own binder and search criteria, but if no binder is specified a default binder is used. For more information, see the System.Reflection.Binder and System.Reflection.BindingFlags classes.
An evidence parameter affects the security policy and permissions for the constructor. For more information, see the System.Security.Policy.Evidence class.
An instance of a type can be created at a local or remote site. If the type is created remotely, an activation attribute parameter specifies the URI of the remote site. The call to create the instance might pass through intermediary sites before it reaches the remote site. Other activation attributes can modify the environment, or context, in which the call operates at the remote and intermediary sites.
If the instance is created locally, a reference to that object is returned. If the instance is created remotely, a reference to a proxy is returned. The remote object is manipulated through the proxy as if it were a local object.
The GetObject method creates a proxy to a currently running remote object, server-activated well-known object, or XML Web service. You can specify the connection medium, that is, the channel. For more information, see the System.Runtime.Remoting.Channels.ChannelServices class.
Assemblies contain type definitions. The CreateInstance method creates an instance of a type from a currently running assembly. The CreateInstanceFrom method creates an instance from a file that contains an assembly. The CreateComInstanceFrom method creates an instance of a COM object from a file that contains an assembly.
For more information about server-activated and client-activated objects, see the Server Activation topic.
|
|