HttpListenerPrefixCollection.Contains(String) 메서드

정의

지정된 접두사가 컬렉션에 포함되어 있는지 여부를 나타내는 Boolean 값을 반환합니다.

public:
 virtual bool Contains(System::String ^ uriPrefix);
public bool Contains (string uriPrefix);
abstract member Contains : string -> bool
override this.Contains : string -> bool
Public Function Contains (uriPrefix As String) As Boolean

매개 변수

uriPrefix
String

테스트할 URI(Uniform Resource Identifier) 접두사가 포함된 String입니다.

반환

uriPrefix에 지정된 접두사가 이 컬렉션에 있으면 true이고, 그렇지 않으면 false입니다.

구현

예외

uriPrefix이(가) null인 경우

예제

다음 코드 예제에서는 사용자 지정 접두사 가 의 접두사 컬렉션에 포함되어 있는지 확인합니다 HttpListener.

public static bool CheckForPrefix(HttpListener listener, string prefix)
{
    // Get the prefixes that the Web server is listening to.
    HttpListenerPrefixCollection prefixes = listener.Prefixes;
    if (prefixes.Count == 0 || prefix == null)
    {
        return false;
    }
    return prefixes.Contains(prefix);
}
Public Shared Function CheckForPrefix(ByVal listener As HttpListener, ByVal prefix As String) As Boolean
    Dim prefixes As HttpListenerPrefixCollection = listener.Prefixes

    ' Get the prefixes that the Web server is listening to.
    If prefixes.Count = 0 OrElse prefix Is Nothing Then
        Return False
    End If

    Return prefixes.Contains(prefix)
End Function

설명

지정된 접두사는 기존 값과 정확히 일치해야 합니다.

적용 대상

추가 정보