1 // System.Reflection.ParameterInfo
3 // Sean MacIsaac (macisaac@ximian.com)
5 // (C) 2001 Ximian, Inc.
7 using System
.Reflection
.Emit
;
9 namespace System
.Reflection
12 public class ParameterInfo
: ICustomAttributeProvider
14 protected Type ClassImpl
;
15 protected object DefaultValueImpl
;
16 protected MemberInfo MemberImpl
;
17 protected string NameImpl
;
18 protected int PositionImpl
;
19 protected ParameterAttributes AttrsImpl
;
21 protected ParameterInfo () {
24 internal ParameterInfo (ParameterBuilder pb
, Type type
, MemberInfo member
, int position
) {
25 this.ClassImpl
= type
;
26 this.MemberImpl
= member
;
28 this.NameImpl
= pb
.Name
;
29 this.PositionImpl
= pb
.Position
- 1; // ParameterInfo.Position is zero-based
30 this.AttrsImpl
= (ParameterAttributes
) pb
.Attributes
;
33 this.PositionImpl
= position
- 1;
34 this.AttrsImpl
= ParameterAttributes
.None
;
38 /* to build a ParameterInfo for the return type of a method */
39 internal ParameterInfo (Type type
, MemberInfo member
) {
40 this.ClassImpl
= type
;
41 this.MemberImpl
= member
;
43 this.PositionImpl
= -1; // since parameter positions are zero-based, return type pos is -1
44 this.AttrsImpl
= ParameterAttributes
.Retval
;
47 public virtual Type ParameterType
{
48 get {return ClassImpl;}
50 public virtual ParameterAttributes Attributes
{
51 get {return AttrsImpl;}
53 public virtual object DefaultValue
{
54 get {return DefaultValueImpl;}
58 get {return (AttrsImpl & ParameterAttributes.In) != 0;}
62 get {return (AttrsImpl & ParameterAttributes.Lcid) != 0;}
65 public bool IsOptional
{
66 get {return (AttrsImpl & ParameterAttributes.Optional) != 0;}
70 get {return (AttrsImpl & ParameterAttributes.Out) != 0;}
73 public bool IsRetval
{
74 get {return (AttrsImpl & ParameterAttributes.Retval) != 0;}
77 public virtual MemberInfo Member
{
78 get {return MemberImpl;}
81 public virtual string Name
{
82 get {return NameImpl;}
85 public virtual int Position
{
86 get {return PositionImpl;}
89 public virtual object[] GetCustomAttributes (bool inherit
)
91 return MonoCustomAttrs
.GetCustomAttributes (this, inherit
);
94 public virtual object[] GetCustomAttributes (Type attributeType
, bool inherit
)
96 return MonoCustomAttrs
.GetCustomAttributes (this, attributeType
, inherit
);
99 public virtual bool IsDefined( Type attributeType
, bool inherit
) {
100 return MonoCustomAttrs
.IsDefined (this, attributeType
, inherit
);