mscorlib(4.0.0.0) API with additions
ArgIterator.cs
2 using System.Security;
3 
4 namespace System
5 {
7  public struct ArgIterator
8  {
9  private IntPtr ArgCookie;
10 
11  private IntPtr sigPtr;
12 
13  private IntPtr sigPtrLen;
14 
15  private IntPtr ArgPtr;
16 
17  private int RemainingArgs;
18 
19  [MethodImpl(MethodImplOptions.InternalCall)]
20  [SecurityCritical]
21  private extern ArgIterator(IntPtr arglist);
22 
25  [SecuritySafeCritical]
27  {
28  this = new ArgIterator(arglist.Value);
29  }
30 
31  [MethodImpl(MethodImplOptions.InternalCall)]
32  [SecurityCritical]
33  private unsafe extern ArgIterator(IntPtr arglist, void* ptr);
34 
38  [SecurityCritical]
39  [CLSCompliant(false)]
40  public unsafe ArgIterator(RuntimeArgumentHandle arglist, void* ptr)
41  {
42  this = new ArgIterator(arglist.Value, ptr);
43  }
44 
48  [SecuritySafeCritical]
49  [CLSCompliant(false)]
50  public unsafe TypedReference GetNextArg()
51  {
52  TypedReference result = default(TypedReference);
53  FCallGetNextArg(&result);
54  return result;
55  }
56 
57  [MethodImpl(MethodImplOptions.InternalCall)]
58  [SecurityCritical]
59  private unsafe extern void FCallGetNextArg(void* result);
60 
66  [SecuritySafeCritical]
67  [CLSCompliant(false)]
69  {
70  if (sigPtr != IntPtr.Zero)
71  {
72  return GetNextArg();
73  }
74  if (ArgPtr == IntPtr.Zero)
75  {
76  throw new ArgumentNullException();
77  }
78  TypedReference result = default(TypedReference);
79  InternalGetNextArg(&result, rth.GetRuntimeType());
80  return result;
81  }
82 
83  [MethodImpl(MethodImplOptions.InternalCall)]
84  [SecurityCritical]
85  private unsafe extern void InternalGetNextArg(void* result, RuntimeType rt);
86 
88  public void End()
89  {
90  }
91 
94  [MethodImpl(MethodImplOptions.InternalCall)]
95  [SecuritySafeCritical]
96  public extern int GetRemainingCount();
97 
98  [MethodImpl(MethodImplOptions.InternalCall)]
99  [SecurityCritical]
100  private unsafe extern void* _GetNextArgType();
101 
104  [SecuritySafeCritical]
106  {
107  return new RuntimeTypeHandle(Type.GetTypeFromHandleUnsafe((IntPtr)_GetNextArgType()));
108  }
109 
112  public override int GetHashCode()
113  {
114  return ValueType.GetHashCodeOfPtr(ArgCookie);
115  }
116 
121  public override bool Equals(object o)
122  {
123  throw new NotSupportedException(Environment.GetResourceString("NotSupported_NYI"));
124  }
125  }
126 }
The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method th...
unsafe TypedReference GetNextArg(RuntimeTypeHandle rth)
Returns the next argument in a variable-length argument list that has a specified type.
Definition: ArgIterator.cs:68
unsafe RuntimeTypeHandle GetNextArgType()
Returns the type of the next argument.
Definition: ArgIterator.cs:105
override bool Equals(object o)
This method is not supported, and always throws T:System.NotSupportedException.
Definition: ArgIterator.cs:121
int GetRemainingCount()
Returns the number of arguments remaining in the argument list.
Definition: __Canon.cs:3
References a variable-length argument list.
Represents a type using an internal metadata token.
unsafe TypedReference GetNextArg()
Returns the next argument in a variable-length argument list.
Definition: ArgIterator.cs:50
void End()
Concludes processing of the variable-length argument list represented by this instance.
Definition: ArgIterator.cs:88
Represents a variable-length argument list; that is, the parameters of a function that takes a variab...
Definition: ArgIterator.cs:7
Provides information about, and means to manipulate, the current environment and platform....
Definition: Environment.cs:21
Describes objects that contain both a managed pointer to a location and a runtime representation of t...
ArgIterator(RuntimeArgumentHandle arglist)
Initializes a new instance of the T:System.ArgIterator structure using the specified argument list.
Definition: ArgIterator.cs:26
A platform-specific type that is used to represent a pointer or a handle.
Definition: IntPtr.cs:14
Represents type declarations: class types, interface types, array types, value types,...
Definition: Type.cs:18
override int GetHashCode()
Returns the hash code of this object.
Definition: ArgIterator.cs:112
MethodImplOptions
Defines the details of how a method is implemented.
static readonly IntPtr Zero
A read-only field that represents a pointer or handle that has been initialized to zero.
Definition: IntPtr.cs:20
The exception that is thrown when an invoked method is not supported, or when there is an attempt to ...
unsafe ArgIterator(RuntimeArgumentHandle arglist, void *ptr)
Initializes a new instance of the T:System.ArgIterator structure using the specified argument list an...
Definition: ArgIterator.cs:40
Provides the base class for value types.
Definition: ValueType.cs:12