ServiceProvider.GetService Method (Type)
Retrieves a service of the specified type.
Namespace: Microsoft.VisualStudio.Data.Framework
Assembly: Microsoft.VisualStudio.Data.Framework (in Microsoft.VisualStudio.Data.Framework.dll)
Syntax
'Declaration
Public Overridable Function GetService ( _
serviceType As Type _
) As Object
public virtual Object GetService(
Type serviceType
)
public:
virtual Object^ GetService(
Type^ serviceType
)
abstract GetService :
serviceType:Type -> Object
override GetService :
serviceType:Type -> Object
public function GetService(
serviceType : Type
) : Object
Parameters
serviceType
Type: System.TypeThe service type.
Return Value
Type: System.Object
Returns the service of the specified type, or returns nulla null reference (Nothing in Visual Basic) if no service is found.
Implements
IServiceProvider.GetService(Type)
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | The serviceType parameter is nulla null reference (Nothing in Visual Basic). |
Remarks
This method creates the service through a previously specified callback, returns the existing service, or gets the service through a parent service. If this method is not able to obtain the service, it calls the parent service provider, if one exists.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.