mscorlib(4.0.0.0) API with additions
ActivationAttributeStack.cs
2 {
3  internal class ActivationAttributeStack
4  {
5  private object[] activationTypes;
6 
7  private object[] activationAttributes;
8 
9  private int freeIndex;
10 
11  internal ActivationAttributeStack()
12  {
13  activationTypes = new object[4];
14  activationAttributes = new object[4];
15  freeIndex = 0;
16  }
17 
18  internal void Push(Type typ, object[] attr)
19  {
20  if (freeIndex == activationTypes.Length)
21  {
22  object[] destinationArray = new object[activationTypes.Length * 2];
23  object[] destinationArray2 = new object[activationAttributes.Length * 2];
24  Array.Copy(activationTypes, destinationArray, activationTypes.Length);
25  Array.Copy(activationAttributes, destinationArray2, activationAttributes.Length);
26  activationTypes = destinationArray;
27  activationAttributes = destinationArray2;
28  }
29  activationTypes[freeIndex] = typ;
30  activationAttributes[freeIndex] = attr;
31  freeIndex++;
32  }
33 
34  internal object[] Peek(Type typ)
35  {
36  if (freeIndex == 0 || activationTypes[freeIndex - 1] != typ)
37  {
38  return null;
39  }
40  return (object[])activationAttributes[freeIndex - 1];
41  }
42 
43  internal void Pop(Type typ)
44  {
45  if (freeIndex != 0 && activationTypes[freeIndex - 1] == typ)
46  {
47  freeIndex--;
48  activationTypes[freeIndex] = null;
49  activationAttributes[freeIndex] = null;
50  }
51  }
52  }
53 }
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition: Array.cs:17
Represents type declarations: class types, interface types, array types, value types,...
Definition: Type.cs:18
static void Copy(Array sourceArray, Array destinationArray, int length)
Copies a range of elements from an T:System.Array starting at the first element and pastes them into ...
Definition: Array.cs:1275