mscorlib(4.0.0.0) API with additions
KeyContainerPermissionAccessEntryCollection.cs
1 using System.Collections;
3 
5 {
8  [ComVisible(true)]
10  {
11  private ArrayList m_list;
12 
13  private KeyContainerPermissionFlags m_globalFlags;
14 
22  public KeyContainerPermissionAccessEntry this[int index]
23  {
24  get
25  {
26  if (index < 0)
27  {
28  throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_EnumNotStarted"));
29  }
30  if (index >= Count)
31  {
32  throw new ArgumentOutOfRangeException("index", Environment.GetResourceString("ArgumentOutOfRange_Index"));
33  }
34  return (KeyContainerPermissionAccessEntry)m_list[index];
35  }
36  }
37 
40  public int Count => m_list.Count;
41 
45  public bool IsSynchronized => false;
46 
49  public object SyncRoot => this;
50 
52  {
53  }
54 
56  {
57  m_list = new ArrayList();
58  m_globalFlags = globalFlags;
59  }
60 
66  public int Add(KeyContainerPermissionAccessEntry accessEntry)
67  {
68  if (accessEntry == null)
69  {
70  throw new ArgumentNullException("accessEntry");
71  }
72  int num = m_list.IndexOf(accessEntry);
73  if (num == -1)
74  {
75  if (accessEntry.Flags != m_globalFlags)
76  {
77  return m_list.Add(accessEntry);
78  }
79  return -1;
80  }
81  ((KeyContainerPermissionAccessEntry)m_list[num]).Flags &= accessEntry.Flags;
82  return num;
83  }
84 
86  public void Clear()
87  {
88  m_list.Clear();
89  }
90 
95  {
96  return m_list.IndexOf(accessEntry);
97  }
98 
103  public void Remove(KeyContainerPermissionAccessEntry accessEntry)
104  {
105  if (accessEntry == null)
106  {
107  throw new ArgumentNullException("accessEntry");
108  }
109  m_list.Remove(accessEntry);
110  }
111 
115  {
117  }
118 
122  {
124  }
125 
135  void ICollection.CopyTo(Array array, int index)
136  {
137  if (array == null)
138  {
139  throw new ArgumentNullException("array");
140  }
141  if (array.Rank != 1)
142  {
143  throw new ArgumentException(Environment.GetResourceString("Arg_RankMultiDimNotSupported"));
144  }
145  if (index < 0 || index >= array.Length)
146  {
147  throw new ArgumentOutOfRangeException("index", Environment.GetResourceString("ArgumentOutOfRange_Index"));
148  }
149  if (index + Count > array.Length)
150  {
151  throw new ArgumentException(Environment.GetResourceString("Argument_InvalidOffLen"));
152  }
153  for (int i = 0; i < Count; i++)
154  {
155  array.SetValue(this[i], index);
156  index++;
157  }
158  }
159 
169  public void CopyTo(KeyContainerPermissionAccessEntry[] array, int index)
170  {
171  ((ICollection)this).CopyTo((Array)array, index);
172  }
173  }
174 }
The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method th...
void CopyTo(KeyContainerPermissionAccessEntry[] array, int index)
Copies the elements of the collection to a compatible one-dimensional array, starting at the specifie...
Definition: __Canon.cs:3
The exception that is thrown when the value of an argument is outside the allowable range of values a...
Specifies access rights for specific key containers. This class cannot be inherited.
object SyncRoot
Gets an object that can be used to synchronize access to the collection.
Exposes an enumerator, which supports a simple iteration over a non-generic collection....
Definition: IEnumerable.cs:9
Provides information about, and means to manipulate, the current environment and platform....
Definition: Environment.cs:21
int Count
Gets the number of items in the collection.
int Add(KeyContainerPermissionAccessEntry accessEntry)
Adds a T:System.Security.Permissions.KeyContainerPermissionAccessEntry object to the collection.
int IndexOf(KeyContainerPermissionAccessEntry accessEntry)
Gets the index in the collection of the specified T:System.Security.Permissions.KeyContainerPermissio...
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition: Array.cs:17
KeyContainerPermissionFlags
Specifies the type of key container access allowed.
IEnumerator GetEnumerator()
Returns an enumerator that iterates through a collection.
The exception that is thrown when one of the arguments provided to a method is not valid.
void Clear()
Removes all the T:System.Security.Permissions.KeyContainerPermissionAccessEntry objects from the coll...
KeyContainerPermissionAccessEntryEnumerator GetEnumerator()
Returns a T:System.Security.Permissions.KeyContainerPermissionAccessEntryEnumerator object that can b...
Specifies that the class can be serialized.
Represents a collection of T:System.Security.Permissions.KeyContainerPermissionAccessEntry objects....
The exception that is thrown when a method call is invalid for the object's current state.
void Remove(KeyContainerPermissionAccessEntry accessEntry)
Removes the specified T:System.Security.Permissions.KeyContainerPermissionAccessEntry object from the...
bool IsSynchronized
Gets a value indicating whether the collection is synchronized (thread safe).
Defines size, enumerators, and synchronization methods for all nongeneric collections.
Definition: ICollection.cs:8
void CopyTo(Array array, int index)
Copies the elements of the T:System.Collections.ICollection to an T:System.Array, starting at a parti...
KeyContainerPermissionFlags Flags
Gets or sets the key container permissions.
Supports a simple iteration over a non-generic collection.
Definition: IEnumerator.cs:9
Represents the enumerator for T:System.Security.Permissions.KeyContainerPermissionAccessEntry objects...
Implements the T:System.Collections.IList interface using an array whose size is dynamically increase...
Definition: ArrayList.cs:14