Skip to content

IServiceLocator.HasService() method

Defined in

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

Applies to

net11.0, net10.0, net47, net471, net472, net48, net481

Overloads

  1. bool HasService<T>()

  2. bool HasService<T>(string contract)

1. Overload

bool HasService<T>()

Summary: Determines whether a service of the specified type is available from the service provider.

Type parameters

NameDescription
TThe type of service to check for availability.

Returns: bool (opens in a new tab) -- true if a service of type T is available; otherwise, false.

2. Overload

bool HasService<T>(string contract)

Summary: Determines whether a service of the specified type and contract is available from the service provider.

Type parameters

NameDescription
TThe type of the service to check for.

Parameters

NameTypeDescription
contractstring (opens in a new tab)The contract name that identifies the service. Cannot be null.

Returns: bool (opens in a new tab) -- true if a service of type T with the specified contract is available; otherwise, false.