Export (0) Print
Expand All

HttpListenerPrefixCollection.CopyTo Method (String[], Int32)

Note: This method is new in the .NET Framework version 2.0.

Copies the contents of an HttpListenerPrefixCollection to the specified string array.

Namespace: System.Net
Assembly: System (in system.dll)

public void CopyTo (
	string[] array,
	int offset
)
public final void CopyTo (
	String[] array, 
	int offset
)
public final function CopyTo (
	array : String[], 
	offset : int
)

Parameters

array

The one dimensional string array that receives the Uniform Resource Identifier (URI) prefix strings in this collection.

offset

The zero-based index in array at which copying begins.

Exception typeCondition

ArgumentException

array has more than one dimension.

ArgumentOutOfRangeException

This collection contains more elements than can be stored in array starting at offset.

ObjectDisposedException

The HttpListener associated with this collection is closed.

The array must be able to contain strings and cannot be multidimensional.

The following code example copies the prefixes in a HttpListenerPrefixCollection.

public static string[] CopyPrefixes (HttpListener listener)
{
     HttpListenerPrefixCollection prefixes = listener.Prefixes;
     string[] prefixArray = new string[prefixes.Count];
     prefixes.CopyTo(prefixArray, 0);
     return prefixArray;
}

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0

Community Additions

ADD
Show:
© 2014 Microsoft