using System;
using System.Configuration.Assemblies;
using System.Globalization;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Activation;
using System.Security.Policy;
using System.Text;
namespace System
{
/// Contains methods to create types of objects locally or remotely, or obtain references to existing remote objects. This class cannot be inherited.
/// 2
// Token: 0x0200062F RID: 1583
[ClassInterface(ClassInterfaceType.None)]
[ComVisible(true)]
[ComDefaultInterface(typeof(_Activator))]
public sealed class Activator : _Activator
{
// Token: 0x06003A18 RID: 14872 RVA: 0x000C7450 File Offset: 0x000C5650
private Activator()
{
}
/// Maps a set of names to a corresponding set of dispatch identifiers.
/// Reserved for future use. Must be IID_NULL.
/// The passed-in array of names to map.
/// The count of the names to map.
/// The locale context in which to interpret the names.
/// The caller-allocated array that receives the IDs corresponding to the names.
/// Late-bound access using the COM IDispatch interface is not supported.
// Token: 0x06003A19 RID: 14873 RVA: 0x000C7458 File Offset: 0x000C5658
void _Activator.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
{
throw new NotImplementedException();
}
/// Retrieves the type information for an object, which can then be used to get the type information for an interface.
/// The type information to return.
/// The locale identifier for the type information.
/// An object that receives a pointer to the requested type information object.
/// Late-bound access using the COM IDispatch interface is not supported.
// Token: 0x06003A1A RID: 14874 RVA: 0x000C7460 File Offset: 0x000C5660
void _Activator.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo)
{
throw new NotImplementedException();
}
/// Retrieves the number of type information interfaces that an object provides (either 0 or 1).
/// When this method returns, contains a pointer to a location that receives the number of type information interfaces provided by the object. This parameter is passed uninitialized.
/// Late-bound access using the COM IDispatch interface is not supported.
// Token: 0x06003A1B RID: 14875 RVA: 0x000C7468 File Offset: 0x000C5668
void _Activator.GetTypeInfoCount(out uint pcTInfo)
{
throw new NotImplementedException();
}
/// Provides access to properties and methods exposed by an object.
/// A dispatch identifier that identifies the member.
/// Reserved for future use. Must be IID_NULL.
/// The locale context in which to interpret arguments.
/// Flags describing the context of the call.
/// A pointer to a structure that contains an array of arguments, an array of argument DISPIDs for named arguments, and counts for the number of elements in the arrays.
/// A pointer to the location where the result is to be stored.
/// A pointer to a structure that contains exception information.
/// The index of the first argument that has an error.
/// Late-bound access using the COM IDispatch interface is not supported.
// Token: 0x06003A1C RID: 14876 RVA: 0x000C7470 File Offset: 0x000C5670
void _Activator.Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
{
throw new NotImplementedException();
}
/// Creates an instance of the COM object whose name is specified, using the named assembly file and the constructor that best matches the specified parameters.
/// A handle that must be unwrapped to access the newly created instance.
/// The name of a file that contains an assembly where the type named is sought.
/// The name of the preferred type.
///
/// or is null.
/// An instance cannot be created through COM. -or- was not found in .
/// No matching constructor was found.
///
/// is not found, or the module you are trying to load does not specify a file name extension.
/// Cannot create an instance of an abstract class.-or-This member was invoked with a late-binding mechanism.
/// The caller cannot provide activation attributes for an object that does not inherit from .
///
/// is the empty string ("").
/// 1
///
///
///
// Token: 0x06003A1D RID: 14877 RVA: 0x000C7478 File Offset: 0x000C5678
[MonoTODO("No COM support")]
public static ObjectHandle CreateComInstanceFrom(string assemblyName, string typeName)
{
if (assemblyName == null)
{
throw new ArgumentNullException("assemblyName");
}
if (typeName == null)
{
throw new ArgumentNullException("typeName");
}
if (assemblyName.Length == 0)
{
throw new ArgumentException("assemblyName");
}
throw new NotImplementedException();
}
/// Creates an instance of the COM object whose name is specified, using the named assembly file and the default constructor.
/// A handle that must be unwrapped to access the newly created instance.
/// The name of a file that contains an assembly where the type named is sought.
/// The name of the preferred type.
/// The value of the computed hash code.
/// The hash algorithm used for hashing files and generating the strong name.
///
/// or is null.
///
/// is the empty string ("").
/// An assembly or module was loaded twice with two different evidences, or the assembly name is longer than MAX_PATH characters.
///
/// is not found, or the module you are trying to load does not specify a file name extension.
///
/// is found but cannot be loaded.
///
/// is not a valid assembly.
/// A code base that does not start with "file://" was specified without the required WebPermission.
/// An instance cannot be created through COM.-or- was not found in .
/// No matching constructor was found.
/// An instance of an abstract class cannot be created. -or-This member was invoked with a late-binding mechanism.
/// The caller cannot provide activation attributes for an object that does not inherit from .
/// 1
///
///
///
// Token: 0x06003A1E RID: 14878 RVA: 0x000C74B8 File Offset: 0x000C56B8
[MonoTODO("Mono does not support COM")]
public static ObjectHandle CreateComInstanceFrom(string assemblyName, string typeName, byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm)
{
if (assemblyName == null)
{
throw new ArgumentNullException("assemblyName");
}
if (typeName == null)
{
throw new ArgumentNullException("typeName");
}
if (assemblyName.Length == 0)
{
throw new ArgumentException("assemblyName");
}
throw new NotImplementedException();
}
/// Creates an instance of the type whose name is specified, using the named assembly file and default constructor.
/// A handle that must be unwrapped to access the newly created instance.
/// The name of a file that contains an assembly where the type named is sought.
/// The name of the preferred type.
///
/// is null.
/// No matching public constructor was found.
///
/// was not found in .
///
/// was not found.
/// The caller does not have permission to call this constructor.
/// Cannot create an instance of an abstract class, or this member was invoked with a late-binding mechanism.
/// The constructor, which was invoked through reflection, threw an exception.
/// The caller does have the required .
///
/// is not a valid assembly. -or-The common language runtime (CLR) version 2.0 or later is currently loaded, and was compiled for a version of the CLR that is later than the currently loaded version. Note that the .NET Framework versions 2.0, 3.0, and 3.5 all use CLR version 2.0.
/// 1
///
///
///
// Token: 0x06003A1F RID: 14879 RVA: 0x000C74F8 File Offset: 0x000C56F8
public static ObjectHandle CreateInstanceFrom(string assemblyFile, string typeName)
{
return Activator.CreateInstanceFrom(assemblyFile, typeName, null);
}
/// Creates an instance of the type whose name is specified, using the named assembly file and default constructor.
/// A handle that must be unwrapped to access the newly created instance.
/// The name of a file that contains an assembly where the type named is sought.
/// The name of the preferred type.
/// An array of one or more attributes that can participate in activation. This is typically an array that contains a single object. The specifies the URL that is required to activate a remote object.
///
/// is null.
/// No matching public constructor was found.
///
/// was not found in .
///
/// was not found.
/// The caller does not have permission to call this constructor.
/// Cannot create an instance of an abstract class, or this member was invoked with a late-binding mechanism.
/// The constructor, which was invoked through reflection, threw an exception.
///
/// is not an empty array, and the type being created does not derive from .
/// The caller does have the required .
///
/// is not a valid assembly. -or-The common language runtime (CLR) version 2.0 or later is currently loaded, and was compiled for a version of the CLR that is later than the currently loaded version. Note that the .NET Framework versions 2.0, 3.0, and 3.5 all use CLR version 2.0.
/// 1
///
///
///
// Token: 0x06003A20 RID: 14880 RVA: 0x000C7504 File Offset: 0x000C5704
public static ObjectHandle CreateInstanceFrom(string assemblyFile, string typeName, object[] activationAttributes)
{
return Activator.CreateInstanceFrom(assemblyFile, typeName, false, BindingFlags.Instance | BindingFlags.Public | BindingFlags.CreateInstance, null, null, null, activationAttributes, null);
}
/// Creates an instance of the type whose name is specified, using the named assembly file and the constructor that best matches the specified parameters.
/// A handle that must be unwrapped to access the newly created instance.
/// The name of a file that contains an assembly where the type named is sought.
/// The name of the preferred type.
/// true to specify that the search for is not case-sensitive; false to specify that the search is case-sensitive.
/// A combination of zero or more bit flags that affect the search for the constructor. If is zero, a case-sensitive search for public constructors is conducted.
/// An object that uses and to seek and identify the constructor. If is null, the default binder is used.
/// An array of arguments that match in number, order, and type the parameters of the constructor to invoke. If is an empty array or null, the constructor that takes no parameters (the default constructor) is invoked.
/// Culture-specific information that governs the coercion of to the formal types declared for the constructor. If is null, the for the current thread is used.
/// An array of one or more attributes that can participate in activation. This is typically an array that contains a single object. The specifies the URL that is required to activate a remote object.
/// Information used to make security policy decisions and grant code permissions.
///
/// is null.
/// No matching constructor was found.
///
/// was not found in .
///
/// was not found.
/// The caller does not have permission to call this constructor.
/// Cannot create an instance of an abstract class, or this member was invoked with a late-binding mechanism.
/// The constructor, which was invoked through reflection, threw an exception.
/// The caller does have the required .
///
/// is not an empty array, and the type being created does not derive from .
///
/// is not a valid assembly. -or-The common language runtime (CLR) version 2.0 or later is currently loaded, and was compiled for a version of the CLR that is later than the currently loaded version. Note that the .NET Framework versions 2.0, 3.0, and 3.5 all use CLR version 2.0.
/// 1
///
///
///
// Token: 0x06003A21 RID: 14881 RVA: 0x000C7524 File Offset: 0x000C5724
public static ObjectHandle CreateInstanceFrom(string assemblyFile, string typeName, bool ignoreCase, BindingFlags bindingAttr, Binder binder, object[] args, CultureInfo culture, object[] activationAttributes, Evidence securityInfo)
{
Assembly assembly = Assembly.LoadFrom(assemblyFile, securityInfo);
if (assembly == null)
{
return null;
}
Type type = assembly.GetType(typeName, true, ignoreCase);
if (type == null)
{
return null;
}
object obj = Activator.CreateInstance(type, bindingAttr, binder, args, culture, activationAttributes);
return (obj == null) ? null : new ObjectHandle(obj);
}
/// Creates an instance of the type whose name is specified, using the named assembly and default constructor.
/// A handle that must be unwrapped to access the newly created instance.
/// The name of the assembly where the type named is sought. If is null, the executing assembly is searched.
/// The name of the preferred type.
///
/// is null.
/// No matching public constructor was found.
///
/// was not found in .
///
/// was not found.
/// The caller does not have permission to call this constructor.
/// You cannot create an instance of an abstract class, or this member was invoked with a late-binding mechanism.
/// The constructor, which was invoked through reflection, threw an exception.
/// The COM type was not obtained through or .
/// Creation of , , , and types, or arrays of those types, is not supported.
///
/// is not a valid assembly. -or-The common language runtime (CLR) version 2.0 or later is currently loaded, and was compiled for a version of the CLR that is later than the currently loaded version. Note that the .NET Framework versions 2.0, 3.0, and 3.5 all use CLR version 2.0.
/// An assembly or module was loaded twice with two different evidences.
/// 1
///
///
///
// Token: 0x06003A22 RID: 14882 RVA: 0x000C7578 File Offset: 0x000C5778
public static ObjectHandle CreateInstance(string assemblyName, string typeName)
{
if (assemblyName == null)
{
assemblyName = Assembly.GetCallingAssembly().GetName().Name;
}
return Activator.CreateInstance(assemblyName, typeName, null);
}
/// Creates an instance of the type whose name is specified, using the named assembly and default constructor.
/// A handle that must be unwrapped to access the newly created instance.
/// The name of the assembly where the type named is sought. If is null, the executing assembly is searched.
/// The name of the preferred type.
/// An array of one or more attributes that can participate in activation. This is typically an array that contains a single object. The specifies the URL that is required to activate a remote object.
///
/// is null.
/// No matching public constructor was found.
///
/// was not found in .
///
/// was not found.
/// The caller does not have permission to call this constructor.
/// Cannot create an instance of an abstract class, or this member was invoked with a late-binding mechanism.
/// The COM type was not obtained through or .
/// Creation of , , , and types, or arrays of those types, is not supported.-or- is not an empty array, and the type being created does not derive from .-or- is not a array.
///
/// is not a valid assembly. -or-The common language runtime (CLR) version 2.0 or later is currently loaded, and was compiled for a version of the CLR that is later than the currently loaded version. Note that the .NET Framework versions 2.0, 3.0, and 3.5 all use CLR version 2.0.
/// An assembly or module was loaded twice with two different evidences.
/// An error occurred when attempting remote activation in a target specified in .
/// 1
///
///
///
///
///
// Token: 0x06003A23 RID: 14883 RVA: 0x000C75A4 File Offset: 0x000C57A4
public static ObjectHandle CreateInstance(string assemblyName, string typeName, object[] activationAttributes)
{
if (assemblyName == null)
{
assemblyName = Assembly.GetCallingAssembly().GetName().Name;
}
return Activator.CreateInstance(assemblyName, typeName, false, BindingFlags.Instance | BindingFlags.Public | BindingFlags.CreateInstance, null, null, null, activationAttributes, null);
}
/// Creates an instance of the type whose name is specified, using the named assembly and the constructor that best matches the specified parameters.
/// A handle that must be unwrapped to access the newly created instance.
/// The name of the assembly where the type named is sought. If is null, the executing assembly is searched.
/// The name of the preferred type.
/// true to specify that the search for is not case-sensitive; false to specify that the search is case-sensitive.
/// A combination of zero or more bit flags that affect the search for the constructor. If is zero, a case-sensitive search for public constructors is conducted.
/// An object that uses and to seek and identify the constructor. If is null, the default binder is used.
/// An array of arguments that match in number, order, and type the parameters of the constructor to invoke. If is an empty array or null, the constructor that takes no parameters (the default constructor) is invoked.
/// Culture-specific information that governs the coercion of to the formal types declared for the constructor. If is null, the for the current thread is used.
/// An array of one or more attributes that can participate in activation. This is typically an array that contains a single object. The specifies the URL that is required to activate a remote object.
/// Information used to make security policy decisions and grant code permissions.
///
/// is null.
/// No matching constructor was found.
///
/// was not found in .
///
/// was not found.
/// The caller does not have permission to call this constructor.
/// Cannot create an instance of an abstract class, or this member was invoked with a late-binding mechanism.
/// The constructor, which was invoked through reflection, threw an exception.
/// The COM type was not obtained through or .
/// Creation of , , , and types, or arrays of those types, is not supported.-or- is not an empty array, and the type being created does not derive from . -or-The constructor that best matches has varargs arguments.
///
/// is not a valid assembly. -or-The common language runtime (CLR) version 2.0 or later is currently loaded, and was compiled for a version of the CLR that is later than the currently loaded version. Note that the .NET Framework versions 2.0, 3.0, and 3.5 all use CLR version 2.0.
/// An assembly or module was loaded twice with two different evidences.
/// 1
///
///
///
///
///
// Token: 0x06003A24 RID: 14884 RVA: 0x000C75DC File Offset: 0x000C57DC
public static ObjectHandle CreateInstance(string assemblyName, string typeName, bool ignoreCase, BindingFlags bindingAttr, Binder binder, object[] args, CultureInfo culture, object[] activationAttributes, Evidence securityInfo)
{
Assembly assembly;
if (assemblyName == null)
{
assembly = Assembly.GetCallingAssembly();
}
else
{
assembly = Assembly.Load(assemblyName, securityInfo);
}
Type type = assembly.GetType(typeName, true, ignoreCase);
object obj = Activator.CreateInstance(type, bindingAttr, binder, args, culture, activationAttributes);
return (obj == null) ? null : new ObjectHandle(obj);
}
/// Creates an instance of the type designated by the specified object.
/// A handle that must be unwrapped to access the newly created object.
/// An activation context object that specifies the object to create.
// Token: 0x06003A25 RID: 14885 RVA: 0x000C7634 File Offset: 0x000C5834
[MonoNotSupported("no ClickOnce in mono")]
public static ObjectHandle CreateInstance(ActivationContext activationContext)
{
throw new NotImplementedException();
}
/// Creates an instance of the type that is designated by the specified object and activated with the specified custom activation data.
/// A handle that must be unwrapped to access the newly created object.
/// An activation context object that specifies the object to create.
/// An array of Unicode strings that contain custom activation data.
// Token: 0x06003A26 RID: 14886 RVA: 0x000C763C File Offset: 0x000C583C
[MonoNotSupported("no ClickOnce in mono")]
public static ObjectHandle CreateInstance(ActivationContext activationContext, string[] activationCustomData)
{
throw new NotImplementedException();
}
/// Creates an instance of the type whose name is specified in the specified remote domain, using the named assembly file and default constructor.
/// A handle that must be unwrapped to access the newly created instance.
/// The remote domain where the type named is created.
/// The name of a file that contains an assembly where the type named is sought.
/// The name of the preferred type.
///
/// or is null.
/// No matching public constructor was found.
///
/// was not found in .
///
/// was not found.
/// The caller does not have permission to call this constructor.
/// Cannot create an instance of an abstract class, or this member was invoked with a late-binding mechanism.
/// The constructor, which was invoked through reflection, threw an exception.
/// The caller does have the required .
///
/// is not a valid assembly. -or-The common language runtime (CLR) version 2.0 or later is currently loaded, and was compiled for a version of the CLR that is later than the currently loaded version. Note that the .NET Framework versions 2.0, 3.0, and 3.5 all use CLR version 2.0.
// Token: 0x06003A27 RID: 14887 RVA: 0x000C7644 File Offset: 0x000C5844
public static ObjectHandle CreateInstanceFrom(AppDomain domain, string assemblyFile, string typeName)
{
if (domain == null)
{
throw new ArgumentNullException("domain");
}
return domain.CreateInstanceFrom(assemblyFile, typeName);
}
/// Creates an instance of the type whose name is specified in the specified remote domain, using the named assembly file and the constructor that best matches the specified parameters.
/// A handle that must be unwrapped to access the newly created instance.
/// The remote domain where the type named is created.
/// The name of a file that contains an assembly where the type named is sought.
/// The name of the preferred type.
/// true to specify that the search for is not case-sensitive; false to specify that the search is case-sensitive.
/// A combination of zero or more bit flags that affect the search for the constructor. If is zero, a case-sensitive search for public constructors is conducted.
/// An object that uses and to seek and identify the constructor. If is null, the default binder is used.
/// An array of arguments that match in number, order, and type the parameters of the constructor to invoke. If is an empty array or null, the constructor that takes no parameters (the default constructor) is invoked.
/// Culture-specific information that governs the coercion of to the formal types declared for the constructor. If is null, the for the current thread is used.
/// An array of one or more attributes that can participate in activation. This is typically an array that contains a single object. The specifies the URL that is required to activate a remote object.
/// Information used to make security policy decisions and grant code permissions.
///
/// or is null.
/// No matching constructor was found.
///
/// was not found in .
///
/// was not found.
/// The caller does not have permission to call this constructor.
/// Cannot create an instance of an abstract class, or this member was invoked with a late-binding mechanism.
/// The constructor, which was invoked through reflection, threw an exception.
/// The caller does have the required .
///
/// is not an empty array, and the type being created does not derive from .
///
/// is not a valid assembly. -or-The common language runtime (CLR) version 2.0 or later is currently loaded, and was compiled for a version of the CLR that is later than the currently loaded version. Note that the .NET Framework versions 2.0, 3.0, and 3.5 all use CLR version 2.0.
// Token: 0x06003A28 RID: 14888 RVA: 0x000C7660 File Offset: 0x000C5860
public static ObjectHandle CreateInstanceFrom(AppDomain domain, string assemblyFile, string typeName, bool ignoreCase, BindingFlags bindingAttr, Binder binder, object[] args, CultureInfo culture, object[] activationAttributes, Evidence securityAttributes)
{
if (domain == null)
{
throw new ArgumentNullException("domain");
}
return domain.CreateInstanceFrom(assemblyFile, typeName, ignoreCase, bindingAttr, binder, args, culture, activationAttributes, securityAttributes);
}
/// Creates an instance of the type whose name is specified in the specified remote domain, using the named assembly and default constructor.
/// A handle that must be unwrapped to access the newly created instance.
/// The remote domain where the type named is created.
/// The name of the assembly where the type named is sought. If is null, the executing assembly is searched.
/// The name of the preferred type.
///
/// or is null.
/// No matching public constructor was found.
///
/// was not found in .
///
/// was not found.
/// The caller does not have permission to call this constructor.
/// Cannot create an instance of an abstract type. -or-This member was invoked with a late-binding mechanism.
/// The constructor, which was invoked through reflection, threw an exception.
/// The COM type was not obtained through or .
/// Creation of , , , and types, or arrays of those types, is not supported.
///
/// is not a valid assembly. -or-The common language runtime (CLR) version 2.0 or later is currently loaded, and was compiled for a version of the CLR that is later than the currently loaded version. Note that the .NET Framework versions 2.0, 3.0, and 3.5 all use CLR version 2.0.
/// An assembly or module was loaded twice with two different evidences.
// Token: 0x06003A29 RID: 14889 RVA: 0x000C7694 File Offset: 0x000C5894
public static ObjectHandle CreateInstance(AppDomain domain, string assemblyName, string typeName)
{
if (domain == null)
{
throw new ArgumentNullException("domain");
}
return domain.CreateInstance(assemblyName, typeName);
}
/// Creates an instance of the type whose name is specified in the specified remote domain, using the named assembly and the constructor that best matches the specified parameters.
/// A handle that must be unwrapped to access the newly created instance.
/// The domain where the type named is created.
/// The name of the assembly where the type named is sought. If is null, the executing assembly is searched.
/// The name of the preferred type.
/// true to specify that the search for is not case-sensitive; false to specify that the search is case-sensitive.
/// A combination of zero or more bit flags that affect the search for the constructor. If is zero, a case-sensitive search for public constructors is conducted.
/// An object that uses and to seek and identify the constructor. If is null, the default binder is used.
/// An array of arguments that match in number, order, and type the parameters of the constructor to invoke. If is an empty array or null, the constructor that takes no parameters (the default constructor) is invoked.
/// Culture-specific information that governs the coercion of to the formal types declared for the constructor. If is null, the for the current thread is used.
/// An array of one or more attributes that can participate in activation. This is typically an array that contains a single object. The specifies the URL that is required to activate a remote object.
/// Information used to make security policy decisions and grant code permissions.
///
/// or is null.
/// No matching constructor was found.
///
/// was not found in .
///
/// was not found.
/// The caller does not have permission to call this constructor.
/// Cannot create an instance of an abstract class, or this member was invoked with a late-binding mechanism.
/// The constructor, which was invoked through reflection, threw an exception.
/// The COM type was not obtained through or .
/// Creation of , , , and types, or arrays of those types, is not supported.-or- is not an empty array, and the type being created does not derive from . -or-The constructor that best matches has varargs arguments.
///
/// is not a valid assembly. -or-The common language runtime (CLR) version 2.0 or later is currently loaded, and was compiled for a version of the CLR that is later than the currently loaded version. Note that the .NET Framework versions 2.0, 3.0, and 3.5 all use CLR version 2.0.
/// An assembly or module was loaded twice with two different evidences.
// Token: 0x06003A2A RID: 14890 RVA: 0x000C76B0 File Offset: 0x000C58B0
public static ObjectHandle CreateInstance(AppDomain domain, string assemblyName, string typeName, bool ignoreCase, BindingFlags bindingAttr, Binder binder, object[] args, CultureInfo culture, object[] activationAttributes, Evidence securityAttributes)
{
if (domain == null)
{
throw new ArgumentNullException("domain");
}
return domain.CreateInstance(assemblyName, typeName, ignoreCase, bindingAttr, binder, args, culture, activationAttributes, securityAttributes);
}
/// Creates an instance of the type designated by the specified generic type parameter, using the parameterless constructor.
/// A reference to the newly created object.
/// The type to create.
/// The type that is specified for does not have a parameterless constructor.
// Token: 0x06003A2B RID: 14891 RVA: 0x000C76E4 File Offset: 0x000C58E4
public static T CreateInstance()
{
return (T)((object)Activator.CreateInstance(typeof(T)));
}
/// Creates an instance of the specified type using that type's default constructor.
/// A reference to the newly created object.
/// The type of object to create.
///
/// is null.
///
/// is not a RuntimeType. -or- is an open generic type (that is, the property returns true).
///
/// cannot be a .-or- Creation of , , , and types, or arrays of those types, is not supported.
/// The constructor being called throws an exception.
/// The caller does not have permission to call this constructor.
/// Cannot create an instance of an abstract class, or this member was invoked with a late-binding mechanism.
/// The COM type was not obtained through or .
/// No matching public constructor was found.
///
/// is a COM object but the class identifier used to obtain the type is invalid, or the identified class is not registered.
///
/// is not a valid type.
/// 1
///
///
///
// Token: 0x06003A2C RID: 14892 RVA: 0x000C76FC File Offset: 0x000C58FC
public static object CreateInstance(Type type)
{
return Activator.CreateInstance(type, false);
}
/// Creates an instance of the specified type using the constructor that best matches the specified parameters.
/// A reference to the newly created object.
/// The type of object to create.
/// An array of arguments that match in number, order, and type the parameters of the constructor to invoke. If is an empty array or null, the constructor that takes no parameters (the default constructor) is invoked.
///
/// is null.
///
/// is not a RuntimeType. -or- is an open generic type (that is, the property returns true).
///
/// cannot be a .-or- Creation of , , , and types, or arrays of those types, is not supported. -or-The constructor that best matches has varargs arguments.
/// The constructor being called throws an exception.
/// The caller does not have permission to call this constructor.
/// Cannot create an instance of an abstract class, or this member was invoked with a late-binding mechanism.
/// The COM type was not obtained through or .
/// No matching public constructor was found.
///
/// is a COM object but the class identifier used to obtain the type is invalid, or the identified class is not registered.
///
/// is not a valid type.
/// 1
///
///
///
///
///
// Token: 0x06003A2D RID: 14893 RVA: 0x000C7708 File Offset: 0x000C5908
public static object CreateInstance(Type type, params object[] args)
{
return Activator.CreateInstance(type, args, new object[0]);
}
/// Creates an instance of the specified type using the constructor that best matches the specified parameters.
/// A reference to the newly created object.
/// The type of object to create.
/// An array of arguments that match in number, order, and type the parameters of the constructor to invoke. If is an empty array or null, the constructor that takes no parameters (the default constructor) is invoked.
/// An array of one or more attributes that can participate in activation. This is typically an array that contains a single object. The specifies the URL that is required to activate a remote object.
///
/// is null.
///
/// is not a RuntimeType. -or- is an open generic type (that is, the property returns true).
///
/// cannot be a .-or- Creation of , , , and types, or arrays of those types, is not supported.-or- is not an empty array, and the type being created does not derive from . -or-The constructor that best matches has varargs arguments.
/// The constructor being called throws an exception.
/// The caller does not have permission to call this constructor.
/// Cannot create an instance of an abstract class, or this member was invoked with a late-binding mechanism.
/// The COM type was not obtained through or .
/// No matching public constructor was found.
///
/// is a COM object but the class identifier used to obtain the type is invalid, or the identified class is not registered.
///
/// is not a valid type.
/// 1
///
///
///
///
///
// Token: 0x06003A2E RID: 14894 RVA: 0x000C7718 File Offset: 0x000C5918
public static object CreateInstance(Type type, object[] args, object[] activationAttributes)
{
return Activator.CreateInstance(type, BindingFlags.Default, Binder.DefaultBinder, args, null, activationAttributes);
}
/// Creates an instance of the specified type using the constructor that best matches the specified parameters.
/// A reference to the newly created object.
/// The type of object to create.
/// A combination of zero or more bit flags that affect the search for the constructor. If is zero, a case-sensitive search for public constructors is conducted.
/// An object that uses and to seek and identify the constructor. If is null, the default binder is used.
/// An array of arguments that match in number, order, and type the parameters of the constructor to invoke. If is an empty array or null, the constructor that takes no parameters (the default constructor) is invoked.
/// Culture-specific information that governs the coercion of to the formal types declared for the constructor. If is null, the for the current thread is used.
///
/// is null.
///
/// is not a RuntimeType. -or- is an open generic type (that is, the property returns true).
///
/// cannot be a .-or- Creation of , , , and types, or arrays of those types, is not supported. -or-The constructor that best matches has varargs arguments.
/// The constructor being called throws an exception.
/// The caller does not have permission to call this constructor.
/// Cannot create an instance of an abstract class, or this member was invoked with a late-binding mechanism.
/// The COM type was not obtained through or .
/// No matching constructor was found.
///
/// is a COM object but the class identifier used to obtain the type is invalid, or the identified class is not registered.
///
/// is not a valid type.
/// 1
///
///
///
///
///
// Token: 0x06003A2F RID: 14895 RVA: 0x000C772C File Offset: 0x000C592C
public static object CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, object[] args, CultureInfo culture)
{
return Activator.CreateInstance(type, bindingAttr, binder, args, culture, new object[0]);
}
/// Creates an instance of the specified type using the constructor that best matches the specified parameters.
/// A reference to the newly created object.
/// The type of object to create.
/// A combination of zero or more bit flags that affect the search for the constructor. If is zero, a case-sensitive search for public constructors is conducted.
/// An object that uses and to seek and identify the constructor. If is null, the default binder is used.
/// An array of arguments that match in number, order, and type the parameters of the constructor to invoke. If is an empty array or null, the constructor that takes no parameters (the default constructor) is invoked.
/// Culture-specific information that governs the coercion of to the formal types declared for the constructor. If is null, the for the current thread is used.
/// An array of one or more attributes that can participate in activation. This is typically an array that contains a single object. The specifies the URL that is required to activate a remote object.
///
/// is null.
///
/// is not a RuntimeType. -or- is an open generic type (that is, the property returns true).
///
/// cannot be a .-or- Creation of , , , and types, or arrays of those types, is not supported.-or- is not an empty array, and the type being created does not derive from . -or-The constructor that best matches has varargs arguments.
/// The constructor being called throws an exception.
/// The caller does not have permission to call this constructor.
/// Cannot create an instance of an abstract class, or this member was invoked with a late-binding mechanism.
/// The COM type was not obtained through or .
/// No matching constructor was found.
///
/// is a COM object but the class identifier used to obtain the type is invalid, or the identified class is not registered.
///
/// is not a valid type.
/// 1
///
///
///
///
///
// Token: 0x06003A30 RID: 14896 RVA: 0x000C7740 File Offset: 0x000C5940
public static object CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, object[] args, CultureInfo culture, object[] activationAttributes)
{
Activator.CheckType(type);
if (type.ContainsGenericParameters)
{
throw new ArgumentException(type + " is an open generic type", "type");
}
if ((bindingAttr & (BindingFlags.IgnoreCase | BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy)) == BindingFlags.Default)
{
bindingAttr |= BindingFlags.Instance | BindingFlags.Public;
}
int num = 0;
if (args != null)
{
num = args.Length;
}
Type[] array = ((num != 0) ? new Type[num] : Type.EmptyTypes);
for (int i = 0; i < num; i++)
{
if (args[i] != null)
{
array[i] = args[i].GetType();
}
}
if (binder == null)
{
binder = Binder.DefaultBinder;
}
ConstructorInfo constructorInfo = (ConstructorInfo)binder.SelectMethod(bindingAttr, type.GetConstructors(bindingAttr), array, null);
if (constructorInfo != null)
{
Activator.CheckAbstractType(type);
if (activationAttributes != null && activationAttributes.Length > 0)
{
if (!type.IsMarshalByRef)
{
string text = Locale.GetText("Type '{0}' doesn't derive from MarshalByRefObject.", new object[] { type.FullName });
throw new NotSupportedException(text);
}
object obj = ActivationServices.CreateProxyFromAttributes(type, activationAttributes);
if (obj != null)
{
constructorInfo.Invoke(obj, bindingAttr, binder, args, culture);
return obj;
}
}
return constructorInfo.Invoke(bindingAttr, binder, args, culture);
}
if (type.IsValueType && array.Length == 0)
{
return Activator.CreateInstanceInternal(type);
}
StringBuilder stringBuilder = new StringBuilder();
foreach (Type type2 in array)
{
stringBuilder.Append((type2 == null) ? "(unknown)" : type2.ToString());
stringBuilder.Append(", ");
}
if (stringBuilder.Length > 2)
{
stringBuilder.Length -= 2;
}
throw new MissingMethodException(string.Format(Locale.GetText("No constructor found for {0}::.ctor({1})"), type.FullName, stringBuilder));
}
/// Creates an instance of the specified type using that type's default constructor.
/// A reference to the newly created object.
/// The type of object to create.
/// true if a public or nonpublic default constructor can match; false if only a public default constructor can match.
///
/// is null.
///
/// is not a RuntimeType. -or- is an open generic type (that is, the property returns true).
///
/// cannot be a .-or- Creation of , , , and types, or arrays of those types, is not supported.
/// The constructor being called throws an exception.
/// The caller does not have permission to call this constructor.
/// Cannot create an instance of an abstract class, or this member was invoked with a late-binding mechanism.
/// The COM type was not obtained through or .
/// No matching public constructor was found.
///
/// is a COM object but the class identifier used to obtain the type is invalid, or the identified class is not registered.
///
/// is not a valid type.
/// 1
///
///
///
// Token: 0x06003A31 RID: 14897 RVA: 0x000C7910 File Offset: 0x000C5B10
public static object CreateInstance(Type type, bool nonPublic)
{
Activator.CheckType(type);
if (type.ContainsGenericParameters)
{
throw new ArgumentException(type + " is an open generic type", "type");
}
Activator.CheckAbstractType(type);
MonoType monoType = type as MonoType;
ConstructorInfo constructorInfo;
if (monoType != null)
{
constructorInfo = monoType.GetDefaultConstructor();
if (!nonPublic && constructorInfo != null && !constructorInfo.IsPublic)
{
constructorInfo = null;
}
}
else
{
BindingFlags bindingFlags = BindingFlags.Instance | BindingFlags.Public;
if (nonPublic)
{
bindingFlags |= BindingFlags.NonPublic;
}
constructorInfo = type.GetConstructor(bindingFlags, null, CallingConventions.Any, Type.EmptyTypes, null);
}
if (constructorInfo != null)
{
return constructorInfo.Invoke(null);
}
if (type.IsValueType)
{
return Activator.CreateInstanceInternal(type);
}
throw new MissingMethodException(Locale.GetText("Default constructor not found."), ".ctor() of " + type.FullName);
}
// Token: 0x06003A32 RID: 14898 RVA: 0x000C79DC File Offset: 0x000C5BDC
private static void CheckType(Type type)
{
if (type == null)
{
throw new ArgumentNullException("type");
}
if (type == typeof(TypedReference) || type == typeof(ArgIterator) || type == typeof(void) || type == typeof(RuntimeArgumentHandle))
{
string text = Locale.GetText("CreateInstance cannot be used to create this type ({0}).", new object[] { type.FullName });
throw new NotSupportedException(text);
}
}
// Token: 0x06003A33 RID: 14899 RVA: 0x000C7A5C File Offset: 0x000C5C5C
private static void CheckAbstractType(Type type)
{
if (type.IsAbstract)
{
string text = Locale.GetText("Cannot create an abstract class '{0}'.", new object[] { type.FullName });
throw new MissingMethodException(text);
}
}
/// Creates a proxy for the well-known object indicated by the specified type and URL.
/// A proxy that points to an endpoint served by the requested well-known object.
/// The type of the well-known object to which you want to connect.
/// The URL of the well-known object.
///
/// or is null.
///
/// is not marshaled by reference.-or- is an interface.
/// This member was invoked with a late-binding mechanism.
/// 1
///
///
///
///
// Token: 0x06003A34 RID: 14900 RVA: 0x000C7A98 File Offset: 0x000C5C98
public static object GetObject(Type type, string url)
{
if (type == null)
{
throw new ArgumentNullException("type");
}
return RemotingServices.Connect(type, url);
}
/// Creates a proxy for the well-known object indicated by the specified type, URL, and channel data.
/// A proxy that points to an endpoint served by the requested well-known object.
/// The type of the well-known object to which you want to connect.
/// The URL of the well-known object.
/// Channel-specific data or null.
///
/// or is null.
///
/// is not marshaled by reference.-or- is an interface.
/// This member was invoked with a late-binding mechanism.
/// 1
///
///
///
///
// Token: 0x06003A35 RID: 14901 RVA: 0x000C7AB4 File Offset: 0x000C5CB4
public static object GetObject(Type type, string url, object state)
{
if (type == null)
{
throw new ArgumentNullException("type");
}
return RemotingServices.Connect(type, url, state);
}
// Token: 0x06003A36 RID: 14902
[MethodImpl(MethodImplOptions.InternalCall)]
internal static extern object CreateInstanceInternal(Type type);
// Token: 0x04001769 RID: 5993
private const BindingFlags _flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.CreateInstance;
// Token: 0x0400176A RID: 5994
private const BindingFlags _accessFlags = BindingFlags.IgnoreCase | BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy;
}
}