CookieCollection.Item[String] CookieCollection.Item[String] CookieCollection.Item[String] CookieCollection.Item[String] Property

Definizione

Overload

Item[Int32] Item[Int32] Item[Int32] Item[Int32]

Ottiene il Cookie con uno specifico indice da un CookieCollection.Gets the Cookie with a specific index from a CookieCollection.

Item[String] Item[String] Item[String] Item[String]

Ottiene il Cookie con uno specifico nome da un CookieCollection.Gets the Cookie with a specific name from a CookieCollection.

Item[Int32] Item[Int32] Item[Int32] Item[Int32]

Ottiene il Cookie con uno specifico indice da un CookieCollection.Gets the Cookie with a specific index from a CookieCollection.

public:
 property System::Net::Cookie ^ default[int] { System::Net::Cookie ^ get(int index); };
public System.Net.Cookie this[int index] { get; }
member this.Item(int) : System.Net.Cookie
Default Public ReadOnly Property Item(index As Integer) As Cookie

Parametri

index
Int32 Int32 Int32 Int32

Indice con inizio zero del Cookie da trovare.The zero-based index of the Cookie to be found.

Valore della proprietà

Cookie con uno specifico indice da un CookieCollection.A Cookie with a specific index from a CookieCollection.

Eccezioni

index è minore di 0 oppure index è maggiore o uguale a Count.index is less than 0 or index is greater than or equal to Count.

Esempi

// Get the cookies in the 'CookieCollection' object using the 'Item' property.
// The 'Item' property in C++ is implemented through Indexers. 
// The class that implements indexers is usually a collection of other objects. 
// This class provides access to those objects with the '<class-instance>[i]' syntax. 
try
{
   if ( cookies->Count == 0 )
   {
      Console::WriteLine( "No cookies to display" );
      return;
   }

   for ( int j = 0; j < cookies->Count; j++ )
      Console::WriteLine( "{0}", cookies[ j ] );
   Console::WriteLine( "" );
}
catch ( Exception^ e ) 
{
   Console::WriteLine( "Exception raised.\nError : {0}", e->Message );
}
// Get the cookies in the 'CookieCollection' object using the 'Item' property.
// The 'Item' property in C# is implemented through Indexers. 
    // The class that implements indexers is usually a collection of other objects. 
    // This class provides access to those objects with the '<class-instance>[i]' syntax. 
try {
	if(cookies.Count == 0) {
		Console.WriteLine("No cookies to display");
		return;
	}
	for(int j = 0; j < cookies.Count; j++)
		Console.WriteLine("{0}", cookies[j].ToString());
	Console.WriteLine("");
}
catch(Exception e) {
	Console.WriteLine("Exception raised.\nError : " + e.Message);
}
 'Get the cookies in the 'CookieCollection' object using the 'Item' property.
 Try
    If cookies.Count = 0 Then
        Console.WriteLine("No cookies to display")
        Return
    End If
    Dim j As Integer
    For j = 0 To cookies.Count - 1
        Console.WriteLine("{0}", cookies(j).ToString())
    Next j
    Console.WriteLine("")
Catch e As Exception
    Console.WriteLine(("Exception raised." + ControlChars.Cr + "Error : " + e.Message))
End Try

Commenti

È possibile usare questa proprietà per scorrere il contenuto di un CookieCollectionoggetto.You can use this to iterate over the contents of a CookieCollection.

Vedi anche

Item[String] Item[String] Item[String] Item[String]

Ottiene il Cookie con uno specifico nome da un CookieCollection.Gets the Cookie with a specific name from a CookieCollection.

public:
 property System::Net::Cookie ^ default[System::String ^] { System::Net::Cookie ^ get(System::String ^ name); };
public System.Net.Cookie this[string name] { get; }
member this.Item(string) : System.Net.Cookie
Default Public ReadOnly Property Item(name As String) As Cookie

Parametri

name
String String String String

Nome della classe Cookie da ricercare.The name of the Cookie to be found.

Valore della proprietà

Cookie con uno specifico nome da un CookieCollection.The Cookie with a specific name from a CookieCollection.

Eccezioni

Esempi

// Get the cookies in the 'CookieCollection' object using the 'Item' property.
// The 'Item' property in C++ is implemented through Indexers. 
// The class that implements indexers is usually a collection of other objects. 
// This class provides access to those objects with the '<class-instance>[i]' syntax. 
try
{
   if ( cookies->Count == 0 )
   {
      Console::WriteLine( "No cookies to display" );
      return;
   }

   Console::WriteLine( "{0}", cookies[ "UserName" ] );
   Console::WriteLine( "{0}", cookies[ "DateOfBirth" ] );
   Console::WriteLine( "{0}", cookies[ "PlaceOfBirth" ] );
   Console::WriteLine( "" );
}
catch ( Exception^ e ) 
{
   Console::WriteLine( "Exception raised.\nError : {0}", e->Message );
}
// Get the cookies in the 'CookieCollection' object using the 'Item' property.
// The 'Item' property in C# is implemented through Indexers. 
// The class that implements indexers is usually a collection of other objects. 
// This class provides access to those objects with the '<class-instance>[i]' syntax. 
try {
    if(cookies.Count == 0) {
        Console.WriteLine("No cookies to display");
        return;
    }
    Console.WriteLine("{0}", cookies["UserName"].ToString());
    Console.WriteLine("{0}", cookies["DateOfBirth"].ToString());
    Console.WriteLine("{0}", cookies["PlaceOfBirth"].ToString());
    Console.WriteLine("");
}
catch(Exception e) {
    Console.WriteLine("Exception raised.\nError : " + e.Message);
}
' Get the cookies in the 'CookieCollection' object using the 'Item' property.


Try
    If cookies.Count = 0 Then
        Console.WriteLine("No cookies to display")
        Return
    End If
    Console.WriteLine("{0}", cookies("UserName").ToString())
    Console.WriteLine("{0}", cookies("DateOfBirth").ToString())
    Console.WriteLine("{0}", cookies("PlaceOfBirth").ToString())
    Console.WriteLine("")
Catch e As Exception
    Console.WriteLine(("Exception raised." + ControlChars.Cr + "Error : " + e.Message))
End Try

Commenti

È possibile usare questa proprietà per scorrere il contenuto di un CookieCollectionoggetto.You can use this to iterate over the contents of a CookieCollection.

Vedi anche

Si applica a