Show / Hide Table of Contents

Class OptionalGenericParameter

A ParameterValue that lets you specify that an instance of a generic type parameter should be resolved, providing the null value if resolving fails.

Inheritance
Object
ParameterValue
GenericBase
OptionalGenericParameter
Implements
IEquatable<Type>
IResolverFactory<Type>
IResolverFactory<ParameterInfo>
Inherited Members
GenericBase.ParameterTypeName
GenericBase.Equals(Type)
GenericBase.GetResolver<TContext>(Type)
GenericBase.GetResolver<TContext>(ParameterInfo)
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 OptionalGenericParameter : GenericBase, IEquatable<Type>, IResolverFactory<Type>, IResolverFactory<ParameterInfo>

Constructors

| Improve this Doc View Source

OptionalGenericParameter(String)

Create a new GenericParameter instance that specifies that the given named generic parameter should be resolved.

Declaration
public OptionalGenericParameter(string genericParameterName)
Parameters
Type Name Description
String genericParameterName

The generic parameter name to resolve.

| Improve this Doc View Source

OptionalGenericParameter(String, String)

Create a new GenericParameter instance that specifies that the given named generic parameter should be resolved.

Declaration
public OptionalGenericParameter(string genericParameterName, string name)
Parameters
Type Name Description
String genericParameterName

The generic parameter name to resolve.

String name

Registration name to use when looking up in the container.

Methods

| Improve this Doc View Source

GetResolver<TContext>(Type, String)

Declaration
protected override ResolveDelegate<TContext> GetResolver<TContext>(Type type, string name)
    where TContext : IResolveContext
Parameters
Type Name Description
Type type
String name
Returns
Type Description
ResolveDelegate<TContext>
Type Parameters
Name Description
TContext
Overrides
GenericBase.GetResolver<TContext>(Type, String)

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