Show / Hide Table of Contents

Class OptionalParameter

A ParameterValue that can be passed to RegisterType(Type, Type, String, ITypeLifetimeManager, InjectionMember[]) to configure a parameter or property as an optional dependency.

Inheritance
Object
ParameterValue
ParameterBase
OptionalParameter
OptionalParameter<T>
Implements
IEquatable<Type>
IResolverFactory<Type>
IResolverFactory<ParameterInfo>
Inherited Members
ParameterBase.ParameterType
ParameterBase.Equals(Type)
Object.Equals(Object)
Object.Equals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
Object.ToString()
Namespace: Unity.Injection
Assembly: Unity.Abstractions.dll
Syntax
public class OptionalParameter : ParameterBase, IEquatable<Type>, IResolverFactory<Type>, IResolverFactory<ParameterInfo>

Constructors

| Improve this Doc View Source

OptionalParameter()

Construct a new OptionalParameter instance that specifies to optionally resolve whatever Type specified at this position

Declaration
public OptionalParameter()
| Improve this Doc View Source

OptionalParameter(String)

Construct a new OptionalParameter object that specifies the given name.

Declaration
public OptionalParameter(string name)
Parameters
Type Name Description
String name

Name for the dependency.

| Improve this Doc View Source

OptionalParameter(Type)

Construct a new OptionalParameter object that specifies the given type.

Declaration
public OptionalParameter(Type type)
Parameters
Type Name Description
Type type

Type of the dependency.

| Improve this Doc View Source

OptionalParameter(Type, String)

Construct a new OptionalParameter object that specifies the given type and name.

Declaration
public OptionalParameter(Type type, string name)
Parameters
Type Name Description
Type type

Type of the dependency.

String name

Name for the dependency.

Methods

| Improve this Doc View Source

GetResolver<TContext>(ParameterInfo)

Declaration
public ResolveDelegate<TContext> GetResolver<TContext>(ParameterInfo info)
    where TContext : IResolveContext
Parameters
Type Name Description
ParameterInfo info
Returns
Type Description
ResolveDelegate<TContext>
Type Parameters
Name Description
TContext
| Improve this Doc View Source

GetResolver<TContext>(Type)

Declaration
public ResolveDelegate<TContext> GetResolver<TContext>(Type type)
    where TContext : IResolveContext
Parameters
Type Name Description
Type type
Returns
Type Description
ResolveDelegate<TContext>
Type Parameters
Name Description
TContext

Implements

System.IEquatable<T>
IResolverFactory<TMemberInfo>
IResolverFactory<TMemberInfo>

Extension Methods

InjectionMatching.Matches(Object, Type)
InjectionMatching.MatchesObject(Object, Type)
  • Improve this Doc
  • View Source
In This Article
Back to top Copyright © 2020 .NET Foundation and Contributors. All Rights Reserved