Skip to content

IMutableDependencyResolver.HasRegistration(Type?) method

Defined in

Type: IMutableDependencyResolver Namespace: Splat Assembly: Splat.Core.dll

Applies to

net10.0, net10.0-browserwasm1.0, net10.0-desktop1.0, net9.0, net9.0-browserwasm1.0, net9.0-desktop1.0, net8.0, net8.0-ios17.5, net8.0-maccatalyst17.5, net8.0-macos14.2, net8.0-macos14.5, net8.0-tvos17.2, netstandard2.1, net462, net481

Overloads

  • 1. bool HasRegistration(Type? serviceType)
  • 2. bool HasRegistration(Type? serviceType, string? contract)
  • 3. bool HasRegistration<T>()
  • 4. bool HasRegistration<T>(string? contract)

1. Overload

bool HasRegistration(Type? serviceType)

Summary: Determines whether a registration exists for the specified service type.

Parameters

NameTypeDescription
serviceTypeType?The type of the service to check for registration. Can be null to indicate an unspecified service type.

Returns: bool -- true if a registration exists for the specified service type; otherwise, false.

2. Overload

bool HasRegistration(Type? serviceType, string? contract)

Summary: Determines whether a registration exists for the specified service type and contract.

Parameters

NameTypeDescription
serviceTypeType?The type of the service to check for registration. Can be null to indicate a default or unspecified service type, depending on the implementation.
contractstring?An optional contract name that distinguishes between multiple registrations of the same service type. Can be null or empty to indicate the default contract.

Returns: bool -- true if a registration exists for the specified service type and contract; otherwise, false.

3. Overload

bool HasRegistration<T>()

Summary: Determines whether a registration exists for the specified service type.

Type parameters

NameDescription
TThe type of the service to check for registration.

Returns: bool -- true if a registration for the specified service type exists; otherwise, false.

4. Overload

bool HasRegistration<T>(string? contract)

Summary: Determines whether a registration exists for the specified service type and contract.

Type parameters

NameDescription
TThe service type to check for a registration.

Parameters

NameTypeDescription
contractstring?An optional contract name that identifies a specific registration. Can be null to check for the default registration.

Returns: bool -- true if a registration exists for the specified service type and contract; otherwise, false.