[Serializable] |
ctor #1 | Default constructor. This constructor is called by derived class constructors to initialize state in this type. Initializes a new instance of the CookieCollection class. |
Count | Read-only Gets the number of cookies contained in a CookieCollection. |
IsReadOnly | Read-only Gets a value indicating whether a CookieCollection is read-only. |
IsSynchronized | Read-only Gets a value indicating whether access to a CookieCollection is thread safe. |
Item | Read-only Overloaded: Item[int index] {get Gets the Cookie with a specific index from a CookieCollection. |
Item | Read-only Overloaded: Item[string name] {get Gets the Cookie with a specific name from a CookieCollection. |
SyncRoot | Read-only Gets an object that you can use to synchronize access to the CookieCollection. |
Add | Overloaded:Add(Cookie cookie) Adds a Cookie to a CookieCollection. |
Add | Overloaded:Add(CookieCollection cookies) Adds the contents of a CookieCollection to the current instance. |
CopyTo | Copies the elements of a CookieCollection to an instance of the Array class, starting at a particular index. |
Equals (inherited from System.Object) |
See base class member description: System.Object.Equals Derived from System.Object, the primary base class for all objects. |
GetEnumerator | Gets an enumerator that can iterate through a CookieCollection. |
GetHashCode (inherited from System.Object) |
See base class member description: System.Object.GetHashCode Derived from System.Object, the primary base class for all objects. |
GetType (inherited from System.Object) |
See base class member description: System.Object.GetType Derived from System.Object, the primary base class for all objects. |
ToString (inherited from System.Object) |
See base class member description: System.Object.ToString Derived from System.Object, the primary base class for all objects. |
Finalize (inherited from System.Object) |
See base class member description: System.Object.Finalize Derived from System.Object, the primary base class for all objects. |
MemberwiseClone (inherited from System.Object) |
See base class member description: System.Object.MemberwiseClone Derived from System.Object, the primary base class for all objects. |
Hierarchy:
public CookieCollection(); |
Property | Default |
---|---|
IsReadOnly | true |
Count | 0 |
IsSynchronized | false |
public int Count {get;}
|
public bool IsReadOnly {get;}
|
public bool IsSynchronized {get;}
|
public Cookie this[int index] {get;}
|
index
Exception Type | Condition |
---|---|
ArgumentOutOfRangeException | index < 0 or index >= Count |
// 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); }
public Cookie this[string name] {get;}
|
name
Exception Type | Condition |
---|---|
ArgumentNullException | name is null. |
// 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); }
public object SyncRoot {get;}
|
public void Add( |
cookie
Exception Type | Condition |
---|---|
ArgumentNullException | cookie is null |
public void Add( |
cookies
Exception Type | Condition |
---|---|
ArgumentNullException | cookies is null |
array
index
~CookieCollection(); |
public IEnumerator GetEnumerator(); |
When an enumerator is created, it takes a snapshot of the current state of the collection. If changes such as adding, modifying, or deleting elements are made to the collection, the snapshot gets out of sync and the enumerator throws an InvalidOperationException. Two enumerators created from the same collection at the same time can produce different snapshots of the collection.
public virtual int GetHashCode(); |
public Type GetType(); |
protected object MemberwiseClone(); |
public virtual string ToString(); |