mscorlib(4.0.0.0) API with additions
Activator.cs
2 using System.Diagnostics;
4 using System.Reflection;
10 using System.Security;
11 using System.Security.Policy;
12 using System.Threading;
13 
14 namespace System
15 {
17  [ClassInterface(ClassInterfaceType.None)]
18  [ComDefaultInterface(typeof(_Activator))]
19  [ComVisible(true)]
20  [__DynamicallyInvokable]
21  public sealed class Activator : _Activator
22  {
23  internal const int LookupMask = 255;
24 
25  internal const BindingFlags ConLookup = BindingFlags.Instance | BindingFlags.Public;
26 
27  internal const BindingFlags ConstructorDefault = BindingFlags.Instance | BindingFlags.Public | BindingFlags.CreateInstance;
28 
29  private Activator()
30  {
31  }
32 
57  public static object CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, object[] args, CultureInfo culture)
58  {
59  return CreateInstance(type, bindingAttr, binder, args, culture, null);
60  }
61 
88  [MethodImpl(MethodImplOptions.NoInlining)]
89  [SecuritySafeCritical]
90  public static object CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, object[] args, CultureInfo culture, object[] activationAttributes)
91  {
92  if ((object)type == null)
93  {
94  throw new ArgumentNullException("type");
95  }
96  if (type is TypeBuilder)
97  {
98  throw new NotSupportedException(Environment.GetResourceString("NotSupported_CreateInstanceWithTypeBuilder"));
99  }
100  if ((bindingAttr & (BindingFlags)255) == BindingFlags.Default)
101  {
102  bindingAttr |= (BindingFlags.Instance | BindingFlags.Public | BindingFlags.CreateInstance);
103  }
104  if (activationAttributes != null && activationAttributes.Length != 0)
105  {
106  if (!type.IsMarshalByRef)
107  {
108  throw new NotSupportedException(Environment.GetResourceString("NotSupported_ActivAttrOnNonMBR"));
109  }
110  if (!type.IsContextful && (activationAttributes.Length > 1 || !(activationAttributes[0] is UrlAttribute)))
111  {
112  throw new NotSupportedException(Environment.GetResourceString("NotSupported_NonUrlAttrOnMBR"));
113  }
114  }
115  RuntimeType runtimeType = type.UnderlyingSystemType as RuntimeType;
116  if (runtimeType == null)
117  {
118  throw new ArgumentException(Environment.GetResourceString("Arg_MustBeType"), "type");
119  }
120  StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
121  return runtimeType.CreateInstanceImpl(bindingAttr, binder, args, culture, activationAttributes, ref stackMark);
122  }
123 
147  [__DynamicallyInvokable]
148  public static object CreateInstance(Type type, params object[] args)
149  {
150  return CreateInstance(type, BindingFlags.Instance | BindingFlags.Public | BindingFlags.CreateInstance, null, args, null, null);
151  }
152 
176  public static object CreateInstance(Type type, object[] args, object[] activationAttributes)
177  {
178  return CreateInstance(type, BindingFlags.Instance | BindingFlags.Public | BindingFlags.CreateInstance, null, args, null, activationAttributes);
179  }
180 
203  [__DynamicallyInvokable]
204  public static object CreateInstance(Type type)
205  {
206  return CreateInstance(type, nonPublic: false);
207  }
208 
228  [MethodImpl(MethodImplOptions.NoInlining)]
229  [SecuritySafeCritical]
230  public static ObjectHandle CreateInstance(string assemblyName, string typeName)
231  {
232  StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
233  return CreateInstance(assemblyName, typeName, ignoreCase: false, BindingFlags.Instance | BindingFlags.Public | BindingFlags.CreateInstance, null, null, null, null, null, ref stackMark);
234  }
235 
258  [MethodImpl(MethodImplOptions.NoInlining)]
259  [SecuritySafeCritical]
260  public static ObjectHandle CreateInstance(string assemblyName, string typeName, object[] activationAttributes)
261  {
262  StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
263  return CreateInstance(assemblyName, typeName, ignoreCase: false, BindingFlags.Instance | BindingFlags.Public | BindingFlags.CreateInstance, null, null, null, activationAttributes, null, ref stackMark);
264  }
265 
288  [MethodImpl(MethodImplOptions.NoInlining)]
289  public static object CreateInstance(Type type, bool nonPublic)
290  {
291  if ((object)type == null)
292  {
293  throw new ArgumentNullException("type");
294  }
295  RuntimeType runtimeType = type.UnderlyingSystemType as RuntimeType;
296  if (runtimeType == null)
297  {
298  throw new ArgumentException(Environment.GetResourceString("Arg_MustBeType"), "type");
299  }
300  StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
301  return runtimeType.CreateInstanceDefaultCtor(!nonPublic, skipCheckThis: false, fillCache: true, ref stackMark);
302  }
303 
309  [MethodImpl(MethodImplOptions.NoInlining)]
310  [__DynamicallyInvokable]
311  public static T CreateInstance<T>()
312  {
313  RuntimeType runtimeType = typeof(T) as RuntimeType;
314  if (runtimeType.HasElementType)
315  {
316  throw new MissingMethodException(Environment.GetResourceString("Arg_NoDefCTor"));
317  }
318  StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
319  return (T)runtimeType.CreateInstanceDefaultCtor(publicOnly: true, skipCheckThis: true, fillCache: true, ref stackMark);
320  }
321 
339  public static ObjectHandle CreateInstanceFrom(string assemblyFile, string typeName)
340  {
341  return CreateInstanceFrom(assemblyFile, typeName, null);
342  }
343 
364  public static ObjectHandle CreateInstanceFrom(string assemblyFile, string typeName, object[] activationAttributes)
365  {
366  return CreateInstanceFrom(assemblyFile, typeName, ignoreCase: false, BindingFlags.Instance | BindingFlags.Public | BindingFlags.CreateInstance, null, null, null, activationAttributes);
367  }
368 
397  [MethodImpl(MethodImplOptions.NoInlining)]
398  [SecuritySafeCritical]
399  [Obsolete("Methods which use evidence to sandbox are obsolete and will be removed in a future release of the .NET Framework. Please use an overload of CreateInstance which does not take an Evidence parameter. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")]
400  public static ObjectHandle CreateInstance(string assemblyName, string typeName, bool ignoreCase, BindingFlags bindingAttr, Binder binder, object[] args, CultureInfo culture, object[] activationAttributes, Evidence securityInfo)
401  {
402  StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
403  return CreateInstance(assemblyName, typeName, ignoreCase, bindingAttr, binder, args, culture, activationAttributes, securityInfo, ref stackMark);
404  }
405 
433  [MethodImpl(MethodImplOptions.NoInlining)]
434  [SecuritySafeCritical]
435  public static ObjectHandle CreateInstance(string assemblyName, string typeName, bool ignoreCase, BindingFlags bindingAttr, Binder binder, object[] args, CultureInfo culture, object[] activationAttributes)
436  {
437  StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
438  return CreateInstance(assemblyName, typeName, ignoreCase, bindingAttr, binder, args, culture, activationAttributes, null, ref stackMark);
439  }
440 
441  [SecurityCritical]
442  internal static ObjectHandle CreateInstance(string assemblyString, string typeName, bool ignoreCase, BindingFlags bindingAttr, Binder binder, object[] args, CultureInfo culture, object[] activationAttributes, Evidence securityInfo, ref StackCrawlMark stackMark)
443  {
444  if (securityInfo != null && !AppDomain.CurrentDomain.IsLegacyCasPolicyEnabled)
445  {
446  throw new NotSupportedException(Environment.GetResourceString("NotSupported_RequiresCasPolicyImplicit"));
447  }
448  Type type = null;
449  Assembly assembly = null;
450  if (assemblyString == null)
451  {
452  assembly = RuntimeAssembly.GetExecutingAssembly(ref stackMark);
453  }
454  else
455  {
456  RuntimeAssembly assemblyFromResolveEvent;
457  AssemblyName assemblyName = RuntimeAssembly.CreateAssemblyName(assemblyString, forIntrospection: false, out assemblyFromResolveEvent);
458  if (assemblyFromResolveEvent != null)
459  {
460  assembly = assemblyFromResolveEvent;
461  }
462  else if (assemblyName.ContentType == AssemblyContentType.WindowsRuntime)
463  {
464  type = Type.GetType(typeName + ", " + assemblyString, throwOnError: true, ignoreCase);
465  }
466  else
467  {
468  assembly = RuntimeAssembly.InternalLoadAssemblyName(assemblyName, securityInfo, null, ref stackMark, throwOnFileNotFound: true, forIntrospection: false, suppressSecurityChecks: false);
469  }
470  }
471  if (type == null)
472  {
473  if (assembly == null)
474  {
475  return null;
476  }
477  type = assembly.GetType(typeName, throwOnError: true, ignoreCase);
478  }
479  object obj = CreateInstance(type, bindingAttr, binder, args, culture, activationAttributes);
480  if (obj == null)
481  {
482  return null;
483  }
484  return new ObjectHandle(obj);
485  }
486 
514  [Obsolete("Methods which use evidence to sandbox are obsolete and will be removed in a future release of the .NET Framework. Please use an overload of CreateInstanceFrom which does not take an Evidence parameter. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")]
515  public static ObjectHandle CreateInstanceFrom(string assemblyFile, string typeName, bool ignoreCase, BindingFlags bindingAttr, Binder binder, object[] args, CultureInfo culture, object[] activationAttributes, Evidence securityInfo)
516  {
517  if (securityInfo != null && !AppDomain.CurrentDomain.IsLegacyCasPolicyEnabled)
518  {
519  throw new NotSupportedException(Environment.GetResourceString("NotSupported_RequiresCasPolicyImplicit"));
520  }
521  return CreateInstanceFromInternal(assemblyFile, typeName, ignoreCase, bindingAttr, binder, args, culture, activationAttributes, securityInfo);
522  }
523 
550  public static ObjectHandle CreateInstanceFrom(string assemblyFile, string typeName, bool ignoreCase, BindingFlags bindingAttr, Binder binder, object[] args, CultureInfo culture, object[] activationAttributes)
551  {
552  return CreateInstanceFromInternal(assemblyFile, typeName, ignoreCase, bindingAttr, binder, args, culture, activationAttributes, null);
553  }
554 
555  private static ObjectHandle CreateInstanceFromInternal(string assemblyFile, string typeName, bool ignoreCase, BindingFlags bindingAttr, Binder binder, object[] args, CultureInfo culture, object[] activationAttributes, Evidence securityInfo)
556  {
557  Assembly assembly = Assembly.LoadFrom(assemblyFile, securityInfo);
558  Type type = assembly.GetType(typeName, throwOnError: true, ignoreCase);
559  object obj = CreateInstance(type, bindingAttr, binder, args, culture, activationAttributes);
560  if (obj == null)
561  {
562  return null;
563  }
564  return new ObjectHandle(obj);
565  }
566 
587  [SecurityCritical]
588  public static ObjectHandle CreateInstance(AppDomain domain, string assemblyName, string typeName)
589  {
590  if (domain == null)
591  {
592  throw new ArgumentNullException("domain");
593  }
594  return domain.InternalCreateInstanceWithNoSecurity(assemblyName, typeName);
595  }
596 
626  [SecurityCritical]
627  [Obsolete("Methods which use evidence to sandbox are obsolete and will be removed in a future release of the .NET Framework. Please use an overload of CreateInstance which does not take an Evidence parameter. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")]
628  public static ObjectHandle CreateInstance(AppDomain domain, string assemblyName, string typeName, bool ignoreCase, BindingFlags bindingAttr, Binder binder, object[] args, CultureInfo culture, object[] activationAttributes, Evidence securityAttributes)
629  {
630  if (domain == null)
631  {
632  throw new ArgumentNullException("domain");
633  }
634  if (securityAttributes != null && !AppDomain.CurrentDomain.IsLegacyCasPolicyEnabled)
635  {
636  throw new NotSupportedException(Environment.GetResourceString("NotSupported_RequiresCasPolicyImplicit"));
637  }
638  return domain.InternalCreateInstanceWithNoSecurity(assemblyName, typeName, ignoreCase, bindingAttr, binder, args, culture, activationAttributes, securityAttributes);
639  }
640 
669  [SecurityCritical]
670  public static ObjectHandle CreateInstance(AppDomain domain, string assemblyName, string typeName, bool ignoreCase, BindingFlags bindingAttr, Binder binder, object[] args, CultureInfo culture, object[] activationAttributes)
671  {
672  if (domain == null)
673  {
674  throw new ArgumentNullException("domain");
675  }
676  return domain.InternalCreateInstanceWithNoSecurity(assemblyName, typeName, ignoreCase, bindingAttr, binder, args, culture, activationAttributes, null);
677  }
678 
697  [SecurityCritical]
698  public static ObjectHandle CreateInstanceFrom(AppDomain domain, string assemblyFile, string typeName)
699  {
700  if (domain == null)
701  {
702  throw new ArgumentNullException("domain");
703  }
704  return domain.InternalCreateInstanceFromWithNoSecurity(assemblyFile, typeName);
705  }
706 
735  [SecurityCritical]
736  [Obsolete("Methods which use Evidence to sandbox are obsolete and will be removed in a future release of the .NET Framework. Please use an overload of CreateInstanceFrom which does not take an Evidence parameter. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")]
737  public static ObjectHandle CreateInstanceFrom(AppDomain domain, string assemblyFile, string typeName, bool ignoreCase, BindingFlags bindingAttr, Binder binder, object[] args, CultureInfo culture, object[] activationAttributes, Evidence securityAttributes)
738  {
739  if (domain == null)
740  {
741  throw new ArgumentNullException("domain");
742  }
743  if (securityAttributes != null && !AppDomain.CurrentDomain.IsLegacyCasPolicyEnabled)
744  {
745  throw new NotSupportedException(Environment.GetResourceString("NotSupported_RequiresCasPolicyImplicit"));
746  }
747  return domain.InternalCreateInstanceFromWithNoSecurity(assemblyFile, typeName, ignoreCase, bindingAttr, binder, args, culture, activationAttributes, securityAttributes);
748  }
749 
778  [SecurityCritical]
779  public static ObjectHandle CreateInstanceFrom(AppDomain domain, string assemblyFile, string typeName, bool ignoreCase, BindingFlags bindingAttr, Binder binder, object[] args, CultureInfo culture, object[] activationAttributes)
780  {
781  if (domain == null)
782  {
783  throw new ArgumentNullException("domain");
784  }
785  return domain.InternalCreateInstanceFromWithNoSecurity(assemblyFile, typeName, ignoreCase, bindingAttr, binder, args, culture, activationAttributes, null);
786  }
787 
791  [SecuritySafeCritical]
792  public static ObjectHandle CreateInstance(ActivationContext activationContext)
793  {
795  if (appDomainManager == null)
796  {
797  appDomainManager = new AppDomainManager();
798  }
799  return appDomainManager.ApplicationActivator.CreateInstance(activationContext);
800  }
801 
806  [SecuritySafeCritical]
807  public static ObjectHandle CreateInstance(ActivationContext activationContext, string[] activationCustomData)
808  {
810  if (appDomainManager == null)
811  {
812  appDomainManager = new AppDomainManager();
813  }
814  return appDomainManager.ApplicationActivator.CreateInstance(activationContext, activationCustomData);
815  }
816 
832  public static ObjectHandle CreateComInstanceFrom(string assemblyName, string typeName)
833  {
834  return CreateComInstanceFrom(assemblyName, typeName, null, AssemblyHashAlgorithm.None);
835  }
836 
860  public static ObjectHandle CreateComInstanceFrom(string assemblyName, string typeName, byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm)
861  {
862  Assembly assembly = Assembly.LoadFrom(assemblyName, hashValue, hashAlgorithm);
863  Type type = assembly.GetType(typeName, throwOnError: true, ignoreCase: false);
864  object[] customAttributes = type.GetCustomAttributes(typeof(ComVisibleAttribute), inherit: false);
865  if (customAttributes.Length != 0 && !((ComVisibleAttribute)customAttributes[0]).Value)
866  {
867  throw new TypeLoadException(Environment.GetResourceString("Argument_TypeMustBeVisibleFromCom"));
868  }
869  if (assembly == null)
870  {
871  return null;
872  }
873  object obj = CreateInstance(type, BindingFlags.Instance | BindingFlags.Public | BindingFlags.CreateInstance, null, null, null, null);
874  if (obj == null)
875  {
876  return null;
877  }
878  return new ObjectHandle(obj);
879  }
880 
890  [SecurityCritical]
891  public static object GetObject(Type type, string url)
892  {
893  return GetObject(type, url, null);
894  }
895 
906  [SecurityCritical]
907  public static object GetObject(Type type, string url, object state)
908  {
909  if (type == null)
910  {
911  throw new ArgumentNullException("type");
912  }
913  return RemotingServices.Connect(type, url, state);
914  }
915 
916  [Conditional("_DEBUG")]
917  private static void Log(bool test, string title, string success, string failure)
918  {
919  }
920 
924  void _Activator.GetTypeInfoCount(out uint pcTInfo)
925  {
926  throw new NotImplementedException();
927  }
928 
934  void _Activator.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo)
935  {
936  throw new NotImplementedException();
937  }
938 
946  void _Activator.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
947  {
948  throw new NotImplementedException();
949  }
950 
961  void _Activator.Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
962  {
963  throw new NotImplementedException();
964  }
965  }
966 }
static Assembly GetExecutingAssembly()
Gets the assembly that contains the code that is currently executing.
Definition: Assembly.cs:799
static object CreateInstance(Type type)
Creates an instance of the specified type using that type's default constructor.
Definition: Activator.cs:204
AssemblyContentType
Provides information about the type of code contained in an assembly.
The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method th...
virtual ApplicationActivator ApplicationActivator
Gets the application activator that handles the activation of add-ins and manifest-based applications...
static ObjectHandle CreateComInstanceFrom(string assemblyName, string typeName)
Creates an instance of the COM object whose name is specified, using the named assembly file and the ...
Definition: Activator.cs:832
The exception that is thrown when there is an attempt to dynamically access a method that does not ex...
static ObjectHandle CreateInstanceFrom(string assemblyFile, string typeName)
Creates an instance of the type whose name is specified, using the named assembly file and default co...
Definition: Activator.cs:339
static ObjectHandle CreateInstance(ActivationContext activationContext)
Creates an instance of the type designated by the specified T:System.ActivationContext object.
Definition: Activator.cs:792
static ObjectHandle CreateInstance(string assemblyName, string typeName, bool ignoreCase, BindingFlags bindingAttr, Binder binder, object[] args, CultureInfo culture, object[] activationAttributes, Evidence securityInfo)
Creates an instance of the type whose name is specified, using the named assembly and the constructor...
Definition: Activator.cs:400
static ObjectHandle CreateInstance(string assemblyName, string typeName, bool ignoreCase, BindingFlags bindingAttr, Binder binder, object[] args, CultureInfo culture, object[] activationAttributes)
Creates an instance of the type whose name is specified, using the named assembly and the constructor...
Definition: Activator.cs:435
Identifies the activation context for the current application. This class cannot be inherited.
static ObjectHandle CreateInstance(AppDomain domain, string assemblyName, string typeName)
Creates an instance of the type whose name is specified in the specified remote domain,...
Definition: Activator.cs:588
BindingFlags
Specifies flags that control binding and the way in which the search for members and types is conduct...
Definition: BindingFlags.cs:10
Definition: __Canon.cs:3
abstract object [] GetCustomAttributes(bool inherit)
When overridden in a derived class, returns an array of all custom attributes applied to this member.
AssemblyContentType ContentType
Gets or sets a value that indicates what type of content the assembly contains.
abstract Type UnderlyingSystemType
Indicates the type provided by the common language runtime that represents this type.
Definition: Type.cs:816
static object CreateInstance(Type type, object[] args, object[] activationAttributes)
Creates an instance of the specified type using the constructor that best matches the specified param...
Definition: Activator.cs:176
static ObjectHandle CreateInstance(string assemblyName, string typeName)
Creates an instance of the type whose name is specified, using the named assembly and default constru...
Definition: Activator.cs:230
void GetTypeInfoCount(out uint pcTInfo)
Retrieves the number of type information interfaces that an object provides (either 0 or 1).
static AppDomain CurrentDomain
Gets the current application domain for the current T:System.Threading.Thread.
Definition: AppDomain.cs:274
Represents an application domain, which is an isolated environment where applications execute....
Definition: AppDomain.cs:33
static T CreateInstance< T >()
Creates an instance of the type designated by the specified generic type parameter,...
Definition: Activator.cs:311
static ObjectHandle CreateInstanceFrom(AppDomain domain, string assemblyFile, string typeName, bool ignoreCase, BindingFlags bindingAttr, Binder binder, object[] args, CultureInfo culture, object[] activationAttributes)
Creates an instance of the type whose name is specified in the specified remote domain,...
Definition: Activator.cs:779
static ObjectHandle CreateInstanceFrom(string assemblyFile, string typeName, object[] activationAttributes)
Creates an instance of the type whose name is specified, using the named assembly file and default co...
Definition: Activator.cs:364
static ObjectHandle CreateInstanceFrom(string assemblyFile, string typeName, bool ignoreCase, BindingFlags bindingAttr, Binder binder, object[] args, CultureInfo culture, object[] activationAttributes, Evidence securityInfo)
Creates an instance of the type whose name is specified, using the named assembly file and the constr...
Definition: Activator.cs:515
Contains methods to create types of objects locally or remotely, or obtain references to existing rem...
Definition: Activator.cs:21
static object CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, object[] args, CultureInfo culture, object[] activationAttributes)
Creates an instance of the specified type using the constructor that best matches the specified param...
Definition: Activator.cs:90
Provides information about, and means to manipulate, the current environment and platform....
Definition: Environment.cs:21
static object CreateInstance(Type type, bool nonPublic)
Creates an instance of the specified type using that type's default constructor.
Definition: Activator.cs:289
The exception that is thrown when type-loading failures occur.
Defines and creates new instances of classes during run time.
Definition: TypeBuilder.cs:15
void Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
Provides access to properties and methods exposed by an object.
static ObjectHandle CreateInstanceFrom(AppDomain domain, string assemblyFile, string typeName, bool ignoreCase, BindingFlags bindingAttr, Binder binder, object[] args, CultureInfo culture, object[] activationAttributes, Evidence securityAttributes)
Creates an instance of the type whose name is specified in the specified remote domain,...
Definition: Activator.cs:737
Represents an assembly, which is a reusable, versionable, and self-describing building block of a com...
Definition: Assembly.cs:22
Represents type declarations: class types, interface types, array types, value types,...
Definition: Type.cs:18
Wraps marshal-by-value object references, allowing them to be returned through an indirection.
Definition: ObjectHandle.cs:10
static object Connect(Type classToProxy, string url)
Creates a proxy for a well-known object, given the T:System.Type and URL.
MethodImplOptions
Defines the details of how a method is implemented.
Exposes the T:System.Activator class to unmanaged code.
Definition: _Activator.cs:9
static ObjectHandle CreateInstance(AppDomain domain, string assemblyName, string typeName, bool ignoreCase, BindingFlags bindingAttr, Binder binder, object[] args, CultureInfo culture, object[] activationAttributes)
Creates an instance of the type whose name is specified in the specified remote domain,...
Definition: Activator.cs:670
bool IsContextful
Gets a value indicating whether the T:System.Type can be hosted in a context.
Definition: Type.cs:723
Selects a member from a list of candidates, and performs type conversion from actual argument type to...
Definition: Binder.cs:10
static Assembly LoadFrom(string assemblyFile)
Loads an assembly given its file name or path.
Definition: Assembly.cs:369
Provides a managed equivalent of an unmanaged host.
Describes an assembly's unique identity in full.
Definition: AssemblyName.cs:19
static ObjectHandle CreateInstanceFrom(string assemblyFile, string typeName, bool ignoreCase, BindingFlags bindingAttr, Binder binder, object[] args, CultureInfo culture, object[] activationAttributes)
Creates an instance of the type whose name is specified, using the named assembly file and the constr...
Definition: Activator.cs:550
The exception that is thrown when one of the arguments provided to a method is not valid.
static ObjectHandle CreateInstanceFrom(AppDomain domain, string assemblyFile, string typeName)
Creates an instance of the type whose name is specified in the specified remote domain,...
Definition: Activator.cs:698
static object CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, object[] args, CultureInfo culture)
Creates an instance of the specified type using the constructor that best matches the specified param...
Definition: Activator.cs:57
static object GetObject(Type type, string url, object state)
Creates a proxy for the well-known object indicated by the specified type, URL, and channel data.
Definition: Activator.cs:907
static ObjectHandle CreateInstance(AppDomain domain, string assemblyName, string typeName, bool ignoreCase, BindingFlags bindingAttr, Binder binder, object[] args, CultureInfo culture, object[] activationAttributes, Evidence securityAttributes)
Creates an instance of the type whose name is specified in the specified remote domain,...
Definition: Activator.cs:628
Defines the set of information that constitutes input to security policy decisions....
Definition: Evidence.cs:17
void GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
Maps a set of names to a corresponding set of dispatch identifiers.
bool IsMarshalByRef
Gets a value indicating whether the T:System.Type is marshaled by reference.
Definition: Type.cs:728
AppDomainManager DomainManager
Gets the domain manager that was provided by the host when the application domain was initialized.
Definition: AppDomain.cs:245
static object GetObject(Type type, string url)
Creates a proxy for the well-known object indicated by the specified type and URL.
Definition: Activator.cs:891
void GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo)
Retrieves the type information for an object, which can be used to get the type information for an in...
ClassInterfaceType
Identifies the type of class interface that is generated for a class.
Provides information about a specific culture (called a locale for unmanaged code development)....
Definition: CultureInfo.cs:16
The exception that is thrown when an invoked method is not supported, or when there is an attempt to ...
Provides several methods for using and publishing remoted objects and proxies. This class cannot be i...
static ObjectHandle CreateInstance(string assemblyName, string typeName, object[] activationAttributes)
Creates an instance of the type whose name is specified, using the named assembly and default constru...
Definition: Activator.cs:260
Defines an attribute that can be used at the call site to specify the URL where the activation will h...
Definition: UrlAttribute.cs:11
Controls accessibility of an individual managed type or member, or of all types within an assembly,...
AssemblyHashAlgorithm
Specifies all the hash algorithms used for hashing files and for generating the strong name.
static object CreateInstance(Type type, params object[] args)
Creates an instance of the specified type using the constructor that best matches the specified param...
Definition: Activator.cs:148
static ObjectHandle CreateComInstanceFrom(string assemblyName, string typeName, byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm)
Creates an instance of the COM object whose name is specified, using the named assembly file and the ...
Definition: Activator.cs:860
static ObjectHandle CreateInstance(ActivationContext activationContext, string[] activationCustomData)
Creates an instance of the type that is designated by the specified T:System.ActivationContext object...
Definition: Activator.cs:807