次の方法で共有


HttpFileCollection.GetKey メソッド

指定した数値インデックスを持つ HttpFileCollection メンバの名前を返します。

名前空間: System.Web
アセンブリ: System.Web (system.web.dll 内)

構文

'宣言
Public Function GetKey ( _
    index As Integer _
) As String
'使用
Dim instance As HttpFileCollection
Dim index As Integer
Dim returnValue As String

returnValue = instance.GetKey(index)
public string GetKey (
    int index
)
public:
String^ GetKey (
    int index
)
public String GetKey (
    int index
)
public function GetKey (
    index : int
) : String
適用できません。

パラメータ

  • index
    返されるオブジェクト名のインデックス。

戻り値

index で指定された HttpFileCollection メンバの名前。

使用例

ファイル コレクション全体をループし、"CustInfo" という名前のファイル コレクション メンバが見つかった場合にアクションを実行する例を次に示します。

Dim loop1 As Integer
 Dim MyFileColl As HttpFileCollection = Request.Files
 
 For loop1 = 0 To MyFileColl.Count - 1
    If MyFileColl.GetKey(loop1) = "CustInfo" Then
       '...
    End If
 Next loop1
    
int loop1;
 HttpFileCollection MyFileColl = Request.Files;
 
 for( loop1 = 0; loop1 < MyFileColl.Count; loop1++)
 {
    if( MyFileColl.GetKey(loop1) == "CustInfo")
    {
       //...
    }
 }
    
int loop1;
HttpFileCollection myFileColl = get_Request().get_Files();

for (loop1 = 0; loop1 < myFileColl.get_Count(); loop1++) {
    if (myFileColl.GetKey(loop1).Equals("CustInfo")) {
        //...
    }
}
var myFileColl : HttpFileCollection = Request.Files

for(var i=0; i < myFileColl.Count; i++){
  if(myFileColl.GetKey(i) == "CustInfo"){
      //...
  }
}
  

プラットフォーム

Windows 98,Windows Server 2000 SP4,Windows CE,Windows Millennium Edition,Windows Mobile for Pocket PC,Windows Mobile for Smartphone,Windows Server 2003,Windows XP Media Center Edition,Windows XP Professional x64 Edition,Windows XP SP2,Windows XP Starter Edition

Microsoft .NET Framework 3.0 は Windows Vista,Microsoft Windows XP SP2,および Windows Server 2003 SP1 でサポートされています。

バージョン情報

.NET Framework

サポート対象 : 3.0,2.0,1.1,1.0

参照

関連項目

HttpFileCollection クラス
HttpFileCollection メンバ
System.Web 名前空間