指定した Port を PortCollection の末尾に追加します。
Public Function Add( _
ByVal port As Port _) As Integer
[C#]
public int Add(Portport);
[C++]
public: int Add(Port* port);
[JScript]
public function Add(
port : Port) : int;
パラメータ
- port
コレクションに追加する Port 。
戻り値
port パラメータが追加された、0 から始まるインデックス番号。
使用例
myPortCollection = myService.Ports
Dim myNewPort As Port = myPortCollection(0)
myPortCollection.Remove(myNewPort)
' Display the number of ports.
Console.WriteLine(ControlChars.NewLine & _
"Total number of ports before " & _
"adding a new port : " & _
myService.Ports.Count.ToString)
' Add a new port.
myPortCollection.Add(myNewPort)
' Display the number of ports after adding a port.
Console.WriteLine("Total number of ports after " & _
"adding a new port : " & _
myService.Ports.Count.ToString)
[C#]
myPortCollection = myService.Ports;
Port myNewPort = myPortCollection[0];
myPortCollection.Remove(myNewPort);
// Display the number of ports.
Console.WriteLine("\nTotal number of ports before"
+ " adding a new port : " + myService.Ports.Count);
// Add a new port.
myPortCollection.Add(myNewPort);
// Display the number of ports after adding a port.
Console.WriteLine("Total number of ports after"
+ " adding a new port : " + myService.Ports.Count);
[C++]
myPortCollection = myService->Ports;
Port* myNewPort = myPortCollection->Item[0];
myPortCollection->Remove(myNewPort);
// Display the number of ports.
Console::WriteLine(S"\nTotal number of ports before adding a new port : {0}", __box(myService->Ports->Count));
// Add a new port.
myPortCollection->Add(myNewPort);
// Display the number of ports after adding a port.
Console::WriteLine(S"Total number of ports after adding a new port : {0}", __box(myService->Ports->Count));
[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ
参照
PortCollection クラス | PortCollection メンバ | System.Web.Services.Description 名前空間