Intercept.NewInstance Method
Creates a new instance of type type that is intercepted with the behaviors in interceptionBehaviors.
Namespace: Microsoft.Practices.Unity.InterceptionExtension
Assembly: Microsoft.Practices.Unity.Interception (in Microsoft.Practices.Unity.Interception.dll)
Syntax
'Declaration
Public Shared Function NewInstance ( _
type As Type, _
interceptor As ITypeInterceptor, _
interceptionBehaviors As IEnumerable(Of IInterceptionBehavior), _
ParamArray constructorParameters As Object() _
) As Object
public static Object NewInstance(
Type type,
ITypeInterceptor interceptor,
IEnumerable<IInterceptionBehavior> interceptionBehaviors,
params Object[] constructorParameters
)
public:
static Object^ NewInstance(
Type^ type,
ITypeInterceptor^ interceptor,
IEnumerable<IInterceptionBehavior^>^ interceptionBehaviors,
... array<Object^>^ constructorParameters
)
public static function NewInstance(
type : Type,
interceptor : ITypeInterceptor,
interceptionBehaviors : IEnumerable<IInterceptionBehavior>,
... constructorParameters : Object[]
) : Object
Parameters
- type
Type: System.Type
The type of the object to create.
- interceptor
Type: Microsoft.Practices.Unity.InterceptionExtension.ITypeInterceptor
The ITypeInterceptor to use when creating the proxy.
- interceptionBehaviors
Type: System.Collections.Generic.IEnumerable<IInterceptionBehavior>
The interception behaviors for the new proxy.
- constructorParameters
Type: array<System.Object[]
The arguments for the creation of the new instance.
Return Value
An instance of a class compatible with type that includes execution of the given interceptionBehaviors.
Exceptions
Exception | Condition |
---|---|
System.ArgumentNullException | when type is nulla null reference (Nothing in Visual Basic). |
System.ArgumentNullException | when interceptor is nulla null reference (Nothing in Visual Basic). |
System.ArgumentNullException | when interceptionBehaviors is nulla null reference (Nothing in Visual Basic). |
System.ArgumentException | when interceptor cannot intercept type. |