ServiceManager.GetRequiredService<TServiceType> 메서드
지정된 형식의 서비스 인스턴스를 검색합니다.
네임스페이스: Microsoft.Windows.Design
어셈블리: Microsoft.Windows.Design.Extensibility(Microsoft.Windows.Design.Extensibility.dll)
구문
‘선언
Public Function GetRequiredService(Of TServiceType) As TServiceType
public TServiceType GetRequiredService<TServiceType>()
public:
generic<typename TServiceType>
TServiceType GetRequiredService()
member GetRequiredService : unit -> 'TServiceType
JScript에서는 제네릭 형식이나 메서드를 지원하지 않습니다.
Type 매개 변수
- TServiceType
반환 값
형식: TServiceType
요청된 서비스 형식의 인스턴스입니다.이 메서드는 nullNull 참조(Visual Basic의 경우 Nothing)를 반환하지 않습니다.
예외
예외 | 상황 |
---|---|
NotSupportedException | 요청된 형식의 서비스가 없습니다. |
설명
요청된 형식의 서비스를 사용할 수 없는 경우 GetRequiredService<TServiceType>는 NotSupportedException을 throw합니다. nullNull 참조(Visual Basic의 경우 Nothing)은 예외 대신 반환 값으로 허용되는 경우 GetService을 대신 사용하십시오. GetRequiredService<TServiceType>은 보다 신뢰할 수 있는 계약을 제공합니다.
.NET Framework 보안
- 직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분 신뢰 코드에서 라이브러리 사용을 참조하십시오.
참고 항목
참조
Microsoft.Windows.Design 네임스페이스