using System;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace System.Reflection
{
/// Discovers the attributes of a parameter and provides access to parameter metadata.
// Token: 0x02000262 RID: 610
[ClassInterface(ClassInterfaceType.None)]
[ComVisible(true)]
[ComDefaultInterface(typeof(_ParameterInfo))]
[Serializable]
public class ParameterInfo : ICustomAttributeProvider, _ParameterInfo
{
/// Initializes a new instance of the ParameterInfo class.
// Token: 0x06001F9C RID: 8092 RVA: 0x00073F44 File Offset: 0x00072144
protected ParameterInfo()
{
}
// Token: 0x06001F9D RID: 8093 RVA: 0x00073F4C File Offset: 0x0007214C
internal ParameterInfo(ParameterBuilder pb, Type type, MemberInfo member, int position)
{
this.ClassImpl = type;
this.MemberImpl = member;
if (pb != null)
{
this.NameImpl = pb.Name;
this.PositionImpl = pb.Position - 1;
this.AttrsImpl = (ParameterAttributes)pb.Attributes;
}
else
{
this.NameImpl = null;
this.PositionImpl = position - 1;
this.AttrsImpl = ParameterAttributes.None;
}
}
// Token: 0x06001F9E RID: 8094 RVA: 0x00073FB8 File Offset: 0x000721B8
internal ParameterInfo(ParameterInfo pinfo, MemberInfo member)
{
this.ClassImpl = pinfo.ParameterType;
this.MemberImpl = member;
this.NameImpl = pinfo.Name;
this.PositionImpl = pinfo.Position;
this.AttrsImpl = pinfo.Attributes;
}
// Token: 0x06001F9F RID: 8095 RVA: 0x00074004 File Offset: 0x00072204
internal ParameterInfo(Type type, MemberInfo member, UnmanagedMarshal marshalAs)
{
this.ClassImpl = type;
this.MemberImpl = member;
this.NameImpl = string.Empty;
this.PositionImpl = -1;
this.AttrsImpl = ParameterAttributes.Retval;
this.marshalAs = marshalAs;
}
/// Maps a set of names to a corresponding set of dispatch identifiers.
/// Reserved for future use. Must be IID_NULL.
/// Passed-in array of names to be mapped.
/// Count of the names to be mapped.
/// The locale context in which to interpret the names.
/// Caller-allocated array which receives the IDs corresponding to the names.
/// Late-bound access using the COM IDispatch interface is not supported.
// Token: 0x06001FA0 RID: 8096 RVA: 0x00074048 File Offset: 0x00072248
void _ParameterInfo.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
{
throw new NotImplementedException();
}
/// Retrieves the type information for an object, which can then be used to get the type information for an interface.
/// The type information to return.
/// The locale identifier for the type information.
/// Receives a pointer to the requested type information object.
/// Late-bound access using the COM IDispatch interface is not supported.
// Token: 0x06001FA1 RID: 8097 RVA: 0x00074050 File Offset: 0x00072250
void _ParameterInfo.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo)
{
throw new NotImplementedException();
}
/// Retrieves the number of type information interfaces that an object provides (either 0 or 1).
/// Points to a location that receives the number of type information interfaces provided by the object.
/// Late-bound access using the COM IDispatch interface is not supported.
// Token: 0x06001FA2 RID: 8098 RVA: 0x00074058 File Offset: 0x00072258
void _ParameterInfo.GetTypeInfoCount(out uint pcTInfo)
{
throw new NotImplementedException();
}
/// Provides access to properties and methods exposed by an object.
/// Identifies the member.
/// Reserved for future use. Must be IID_NULL.
/// The locale context in which to interpret arguments.
/// Flags describing the context of the call.
/// Pointer to a structure containing an array of arguments, an array of argument DISPIDs for named arguments, and counts for the number of elements in the arrays.
/// Pointer to the location where the result is to be stored.
/// Pointer to a structure that contains exception information.
/// The index of the first argument that has an error.
/// Late-bound access using the COM IDispatch interface is not supported.
// Token: 0x06001FA3 RID: 8099 RVA: 0x00074060 File Offset: 0x00072260
void _ParameterInfo.Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
{
throw new NotImplementedException();
}
/// Gets the parameter type and name represented as a string.
/// A string containing the type and the name of the parameter.
// Token: 0x06001FA4 RID: 8100 RVA: 0x00074068 File Offset: 0x00072268
public override string ToString()
{
Type type = this.ClassImpl;
while (type.HasElementType)
{
type = type.GetElementType();
}
bool flag = type.IsPrimitive || this.ClassImpl == typeof(void) || this.ClassImpl.Namespace == this.MemberImpl.DeclaringType.Namespace;
string text = ((!flag) ? this.ClassImpl.FullName : this.ClassImpl.Name);
if (!this.IsRetval)
{
text += ' ';
text += this.NameImpl;
}
return text;
}
/// Gets the Type of this parameter.
/// The Type object that represents the Type of this parameter.
// Token: 0x170005E2 RID: 1506
// (get) Token: 0x06001FA5 RID: 8101 RVA: 0x00074120 File Offset: 0x00072320
public virtual Type ParameterType
{
get
{
return this.ClassImpl;
}
}
/// Gets the attributes for this parameter.
/// A ParameterAttributes object representing the attributes for this parameter.
// Token: 0x170005E3 RID: 1507
// (get) Token: 0x06001FA6 RID: 8102 RVA: 0x00074128 File Offset: 0x00072328
public virtual ParameterAttributes Attributes
{
get
{
return this.AttrsImpl;
}
}
/// Gets a value indicating the default value if the parameter has a default value.
/// The default value of the parameter, or if the parameter has no default value.
// Token: 0x170005E4 RID: 1508
// (get) Token: 0x06001FA7 RID: 8103 RVA: 0x00074130 File Offset: 0x00072330
public virtual object DefaultValue
{
get
{
if (this.ClassImpl == typeof(decimal))
{
DecimalConstantAttribute[] array = (DecimalConstantAttribute[])this.GetCustomAttributes(typeof(DecimalConstantAttribute), false);
if (array.Length > 0)
{
return array[0].Value;
}
}
else if (this.ClassImpl == typeof(DateTime))
{
DateTimeConstantAttribute[] array2 = (DateTimeConstantAttribute[])this.GetCustomAttributes(typeof(DateTimeConstantAttribute), false);
if (array2.Length > 0)
{
return new DateTime(array2[0].Ticks);
}
}
return this.DefaultValueImpl;
}
}
/// Gets a value indicating whether this is an input parameter.
/// true if the parameter is an input parameter; otherwise, false.
// Token: 0x170005E5 RID: 1509
// (get) Token: 0x06001FA8 RID: 8104 RVA: 0x000741D4 File Offset: 0x000723D4
public bool IsIn
{
get
{
return (this.Attributes & ParameterAttributes.In) != ParameterAttributes.None;
}
}
/// Gets a value indicating whether this parameter is a locale identifier (lcid).
/// true if the parameter is a locale identifier; otherwise, false.
// Token: 0x170005E6 RID: 1510
// (get) Token: 0x06001FA9 RID: 8105 RVA: 0x000741E4 File Offset: 0x000723E4
public bool IsLcid
{
get
{
return (this.Attributes & ParameterAttributes.Lcid) != ParameterAttributes.None;
}
}
/// Gets a value indicating whether this parameter is optional.
/// true if the parameter is optional; otherwise, false.
// Token: 0x170005E7 RID: 1511
// (get) Token: 0x06001FAA RID: 8106 RVA: 0x000741F4 File Offset: 0x000723F4
public bool IsOptional
{
get
{
return (this.Attributes & ParameterAttributes.Optional) != ParameterAttributes.None;
}
}
/// Gets a value indicating whether this is an output parameter.
/// true if the parameter is an output parameter; otherwise, false.
// Token: 0x170005E8 RID: 1512
// (get) Token: 0x06001FAB RID: 8107 RVA: 0x00074208 File Offset: 0x00072408
public bool IsOut
{
get
{
return (this.Attributes & ParameterAttributes.Out) != ParameterAttributes.None;
}
}
/// Gets a value indicating whether this is a Retval parameter.
/// true if the parameter is a Retval; otherwise, false.
// Token: 0x170005E9 RID: 1513
// (get) Token: 0x06001FAC RID: 8108 RVA: 0x00074218 File Offset: 0x00072418
public bool IsRetval
{
get
{
return (this.Attributes & ParameterAttributes.Retval) != ParameterAttributes.None;
}
}
/// Gets a value indicating the member in which the parameter is implemented.
/// A MemberInfo object.
// Token: 0x170005EA RID: 1514
// (get) Token: 0x06001FAD RID: 8109 RVA: 0x00074228 File Offset: 0x00072428
public virtual MemberInfo Member
{
get
{
return this.MemberImpl;
}
}
/// Gets the name of the parameter.
/// A String containing the simple name of this parameter.
// Token: 0x170005EB RID: 1515
// (get) Token: 0x06001FAE RID: 8110 RVA: 0x00074230 File Offset: 0x00072430
public virtual string Name
{
get
{
return this.NameImpl;
}
}
/// Gets the zero-based position of the parameter in the formal parameter list.
/// An integer representing the position this parameter occupies in the parameter list.
// Token: 0x170005EC RID: 1516
// (get) Token: 0x06001FAF RID: 8111 RVA: 0x00074238 File Offset: 0x00072438
public virtual int Position
{
get
{
return this.PositionImpl;
}
}
// Token: 0x06001FB0 RID: 8112
[MethodImpl(MethodImplOptions.InternalCall)]
private extern int GetMetadataToken();
/// Gets a value that identifies this parameter in metadata.
/// A value which, in combination with the module, uniquely identifies this parameter in metadata.
// Token: 0x170005ED RID: 1517
// (get) Token: 0x06001FB1 RID: 8113 RVA: 0x00074240 File Offset: 0x00072440
public int MetadataToken
{
get
{
if (this.MemberImpl is PropertyInfo)
{
PropertyInfo propertyInfo = (PropertyInfo)this.MemberImpl;
MethodInfo methodInfo = propertyInfo.GetGetMethod(true);
if (methodInfo == null)
{
methodInfo = propertyInfo.GetSetMethod(true);
}
return methodInfo.GetParameters()[this.PositionImpl].MetadataToken;
}
if (this.MemberImpl is MethodBase)
{
return this.GetMetadataToken();
}
throw new ArgumentException("Can't produce MetadataToken for member of type " + this.MemberImpl.GetType());
}
}
/// Gets all the custom attributes applied to this parameter.
/// An array that contains all the custom attributes applied to this parameter.
/// This argument is ignored for objects of this type. See Remarks.
/// A custom attribute type could not be loaded.
// Token: 0x06001FB2 RID: 8114 RVA: 0x000742C4 File Offset: 0x000724C4
public virtual object[] GetCustomAttributes(bool inherit)
{
return MonoCustomAttrs.GetCustomAttributes(this, inherit);
}
/// Gets the custom attributes of the specified type or its derived types that are applied to this parameter.
/// An array that contains the custom attributes of the specified type or its derived types.
/// The type of attribute to search for. Only attributes that are assignable to this type are returned.
/// This argument is ignored for objects of this type. See Remarks.
/// The type must be a type provided by the underlying runtime system.
///
/// is null.
/// A custom attribute type could not be loaded.
// Token: 0x06001FB3 RID: 8115 RVA: 0x000742D0 File Offset: 0x000724D0
public virtual object[] GetCustomAttributes(Type attributeType, bool inherit)
{
return MonoCustomAttrs.GetCustomAttributes(this, attributeType, inherit);
}
/// Determines whether the custom attribute of the specified type or its derived types is applied to this parameter.
/// true if one or more instances of or its derived types are applied to this parameter; otherwise, false.
/// The type of attribute to search for. Only attributes that are assignable to this type are returned.
/// This argument is ignored for objects of this type. See Remarks.
///
/// is null.
///
/// is not a object supplied by the common language runtime.
// Token: 0x06001FB4 RID: 8116 RVA: 0x000742DC File Offset: 0x000724DC
public virtual bool IsDefined(Type attributeType, bool inherit)
{
return MonoCustomAttrs.IsDefined(this, attributeType, inherit);
}
// Token: 0x06001FB5 RID: 8117 RVA: 0x000742E8 File Offset: 0x000724E8
internal object[] GetPseudoCustomAttributes()
{
int num = 0;
if (this.IsIn)
{
num++;
}
if (this.IsOut)
{
num++;
}
if (this.IsOptional)
{
num++;
}
if (this.marshalAs != null)
{
num++;
}
if (num == 0)
{
return null;
}
object[] array = new object[num];
num = 0;
if (this.IsIn)
{
array[num++] = new InAttribute();
}
if (this.IsOptional)
{
array[num++] = new OptionalAttribute();
}
if (this.IsOut)
{
array[num++] = new OutAttribute();
}
if (this.marshalAs != null)
{
array[num++] = this.marshalAs.ToMarshalAsAttribute();
}
return array;
}
// Token: 0x06001FB6 RID: 8118
[MethodImpl(MethodImplOptions.InternalCall)]
private extern Type[] GetTypeModifiers(bool optional);
/// Gets the optional custom modifiers of the parameter.
/// An array of objects that identify the optional custom modifiers of the current parameter, such as or .
// Token: 0x06001FB7 RID: 8119 RVA: 0x000743A8 File Offset: 0x000725A8
public virtual Type[] GetOptionalCustomModifiers()
{
Type[] typeModifiers = this.GetTypeModifiers(true);
if (typeModifiers == null)
{
return Type.EmptyTypes;
}
return typeModifiers;
}
/// Gets the required custom modifiers of the parameter.
/// An array of objects that identify the required custom modifiers of the current parameter, such as or .
// Token: 0x06001FB8 RID: 8120 RVA: 0x000743CC File Offset: 0x000725CC
public virtual Type[] GetRequiredCustomModifiers()
{
Type[] typeModifiers = this.GetTypeModifiers(false);
if (typeModifiers == null)
{
return Type.EmptyTypes;
}
return typeModifiers;
}
/// Gets a value indicating the default value if the parameter has a default value.
/// The default value of the parameter, or if the parameter has no default value.
// Token: 0x170005EE RID: 1518
// (get) Token: 0x06001FB9 RID: 8121 RVA: 0x000743F0 File Offset: 0x000725F0
public virtual object RawDefaultValue
{
get
{
return this.DefaultValue;
}
}
/// The Type of the parameter.
// Token: 0x04000AF7 RID: 2807
protected Type ClassImpl;
/// The default value of the parameter.
// Token: 0x04000AF8 RID: 2808
protected object DefaultValueImpl;
/// The member in which the field is implemented.
// Token: 0x04000AF9 RID: 2809
protected MemberInfo MemberImpl;
/// The name of the parameter.
// Token: 0x04000AFA RID: 2810
protected string NameImpl;
/// The zero-based position of the parameter in the parameter list.
// Token: 0x04000AFB RID: 2811
protected int PositionImpl;
/// The attributes of the parameter.
// Token: 0x04000AFC RID: 2812
protected ParameterAttributes AttrsImpl;
// Token: 0x04000AFD RID: 2813
private UnmanagedMarshal marshalAs;
}
}