HttpListenerPrefixCollection.Count Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the number of prefixes contained in the collection.
public:
property int Count { int get(); };
public int Count { get; }
member this.Count : int
Public ReadOnly Property Count As Integer
Property Value
An Int32 that contains the number of prefixes in this collection.
Implements
Examples
The following code example displays the prefixes in a collection.
public static void DisplayPrefixesAndState(HttpListener listener)
{
// List the prefixes to which the server listens.
HttpListenerPrefixCollection prefixes = listener.Prefixes;
if (prefixes.Count == 0)
{
Console.WriteLine("There are no prefixes.");
}
foreach(string prefix in prefixes)
{
Console.WriteLine(prefix);
}
// Show the listening state.
if (listener.IsListening)
{
Console.WriteLine("The server is listening.");
}
}
Public Shared Sub DisplayPrefixesAndState(ByVal listener As HttpListener)
' List the prefixes to which the server listens.
Dim prefixes As HttpListenerPrefixCollection = listener.Prefixes
If prefixes.Count = 0 Then
Console.WriteLine("There are no prefixes.")
End If
For Each prefix As String In prefixes
Console.WriteLine(prefix)
Next
' Show the listening state.
If listener.IsListening Then
Console.WriteLine("The server is listening.")
End If
End Sub
Applies to
See also
GitHub पर हमारे साथ सहयोग करें
इस सामग्री का स्रोत GitHub पर पाया जा सकता है, जहाँ आप समस्याएँ बना और समीक्षा भी कर सकते हैं और अनुरोध खींच सकते हैं. अधिक जानकारी के लिए, हमारे योगदानकर्ता गाइड देखें.