Class ActivatorOptions
- Namespace
- Cuemon.Reflection
- Assembly
- Cuemon.Core.dll
Configuration options for ActivatorFactory.
public class ActivatorOptions : FormattingOptions, IValidatableParameterObject, IParameterObject
- Inheritance
-
ActivatorOptions
- Implements
- Inherited Members
Examples
The following example demonstrates how to use
using System;
using System.Reflection;
using Cuemon.Reflection;
namespace MyApp.Examples;
public class ActivatorOptionsExample
{
public void Demonstrate()
{
// Direct instantiation of ActivatorOptions
var options = new ActivatorOptions
{
Flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.CreateInstance
};
// Create a Uri instance using a factory with explicit binding flags
var uri = ActivatorFactory.CreateInstance<string, Uri>("http://example.com", o =>
{
o.Flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.CreateInstance;
});
Console.WriteLine(uri.Host);
}
}
Constructors
ActivatorOptions()
Initializes a new instance of the ActivatorOptions class.
public ActivatorOptions()
Remarks
The following table shows the initial property values for an instance of ActivatorOptions.
| Property | Initial Value |
|---|---|
| Flags | BindingFlags.Instance | BindingFlags.Public | BindingFlags.CreateInstance |
| Binder | DefaultBinder |
Properties
Binder
Gets or sets the binder that uses Flags and the specified arguments to seek and identify the type constructor.
public Binder Binder { get; set; }
Property Value
- Binder
The binder that uses Flags and the specified arguments to seek and identify the type constructor.
Flags
Gets the binding constraint used for discovering a suitable constructor.
public BindingFlags Flags { get; set; }
Property Value
- BindingFlags
The binding constraint used for discovering a suitable constructor.