Share via


ServiceManager.GetService Method (Type)

When overridden in a derived class, retrieves an instance of a service of the specified type.

Namespace:  Microsoft.Windows.Design
Assembly:  Microsoft.Windows.Design.Extensibility (in Microsoft.Windows.Design.Extensibility.dll)

Syntax

'Declaration
Public MustOverride Function GetService ( _
    serviceType As Type _
) As Object
public abstract Object GetService(
    Type serviceType
)
public:
virtual Object^ GetService(
    Type^ serviceType
) abstract
abstract GetService : 
        serviceType:Type -> Object 
public abstract function GetService(
    serviceType : Type
) : Object

Parameters

  • serviceType
    Type: System.Type
    The type of service to retrieve.

Return Value

Type: System.Object
An instance of the type of service requested; otherwise, nulla null reference (Nothing in Visual Basic).

Implements

IServiceProvider.GetService(Type)

Remarks

If nulla null reference (Nothing in Visual Basic) is not acceptable as a return value and an exception is preferred, use GetRequiredService<TServiceType> instead. GetRequiredService<TServiceType> provides a more reliable contract.

.NET Framework Security

See Also

Reference

ServiceManager Class

GetService Overload

Microsoft.Windows.Design Namespace

EditingContext

ContextItem

Other Resources

WPF Designer Extensibility