ParameterInfo

ParameterInfo CF 1.0, ECMA 1.0, serializable

System.Reflection (mscorlib.dll) class

This class allows the inspection of the type and behavior of a method parameter. Because parameters can have custom attributes on them, the class implements ICustomAttributeProvider . Attributes returns the attributes defined on this parameter. If the parameter has a default, it is stored in DefaultValue . Retrieve the name , type, and member the parameter is from by inspecting Name , ParameterType , and Member . Position returns the ordinal position of this parameter. IsOptional returns true if the parameter is optional, and IsLcid indicates when the parameter is a locale identifier.

A parameter is passed by reference if the IsByRef property of its ParameterType property is true and the IsOut property is false ( out parameters have IsByRef and IsOut set to true ). A parameter that has been marked as [In] has IsOut set to false and IsIn set to true .

 public class  ParameterInfo  : ICustomAttributeProvider {  // Protected Constructors  protected  ParameterInfo  ( );  // Protected Instance Fields  protected ParameterAttributes  AttrsImpl  ;    protected Type  ClassImpl  ;    protected object  DefaultValueImpl  ;    protected MemberInfo  MemberImpl  ;    protected string  NameImpl  ;    protected int  PositionImpl  ;  // Public Instance Properties  public virtual ParameterAttributes  Attributes  {get; }    public virtual object  DefaultValue  {get; }    public bool  IsIn  {get; }    public bool  IsLcid  {get; }    public bool  IsOptional  {get; }    public bool  IsOut  {get; }    public bool  IsRetval  {get; }    public virtual MemberInfo  Member  {get; }    public virtual string  Name  {get; }    public virtual Type  ParameterType  {get; }    public virtual int  Position  {get; }  // Public Instance Methods  public virtual object[ ]  GetCustomAttributes  (bool   inherit   );  // implements ICustomAttributeProvider  public virtual object[ ]  GetCustomAttributes  (Type   attributeType   , bool   inherit   )  // implements ICustomAttributeProvider  public virtual bool  IsDefined  (Type   attributeType   , bool   inherit   );  // implements ICustomAttributeProvider  } 

Returned By

MethodBase.GetParameters( ) , PropertyInfo.GetIndexParameters( )

Passed To

System.Attribute.{GetCustomAttribute( ) , GetCustomAttributes( ) , IsDefined( )}



C# in a Nutshell
C # in a Nutshell, Second Edition
ISBN: 0596005261
EAN: 2147483647
Year: 2005
Pages: 963

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net