Upravit

Sdílet prostřednictvím


<Parameter> Element (.NET Native)

Applies reflection policy to the type of the argument passed to a method.

Syntax

<Parameter Name="parameter_name"
           Activate="policy_type"
           Browse="policy_type"
           Dynamic="policy_type"
           Serialize="policy_type"
           DataContractSerializer="policy_type"
           DataContractJsonSerializer="policy_type"
           XmlSerializer="policy_type"
           MarshalObject="policy_type"
           MarshalDelegate="policy_type"
           MarshalStructure="policy_type" />

Attributes and Elements

The following sections describe attributes, child elements, and parent elements.

Attributes

Attribute Attribute type Description
Name General Required attribute. The parameter name. For example, for the method signature String.CompareTo(Object value), the value of the Name attribute is "value".
Activate Reflection Optional attribute. Controls runtime access to constructors to enable activation of instances.
Browse Reflection Optional attribute. Controls querying for information about program elements, but does not enable any runtime access.
Dynamic Reflection Optional attribute. Controls runtime access to all type members, including constructors, methods, fields, properties, and events, to enable dynamic programming.
Serialize Serialization Optional attribute. Controls runtime access to constructors, fields, and properties, to enable type instances to be serialized and deserialized by libraries such as the Newtonsoft JSON serializer.
DataContractSerializer Serialization Optional attribute. Controls policy for serialization that uses the System.Runtime.Serialization.DataContractSerializer class.
DataContractJsonSerializer Serialization Optional attribute. Controls policy for JSON serialization that uses the System.Runtime.Serialization.DataContractSerializer class.
XmlSerializer Serialization Optional attribute. Controls policy for XML serialization that uses the System.Xml.Serialization.XmlSerializer class.
MarshalObject Interop Optional attribute. Controls policy for marshaling reference types to WinRT and COM.
MarshalDelegate Interop Optional attribute. Controls policy for marshaling delegate types as function pointers to native code.
MarshalStructure Interop Optional attribute. Controls policy for marshaling value types to native code.

Name attribute

Value Description
parameter_name The name of the method parameter to which policy is applied. For example, for the method signature String.CompareTo(Object value), the value of the Name attribute is "value".

All other attributes

Value Description
policy_setting The setting to apply to this policy type. Possible values are All, Public, PublicAndInternal, Required Public, Required PublicAndInternal, and Required All. For more information, see Runtime Directive Policy Settings.

Child Elements

None.

Parent Elements

Element Description
<Method> Applies runtime reflection policy to a constructor or method.

Remarks

The <Parameter> element is a child of the <Method> element and is used to apply policy to a particular method parameter. The specific method parameter is specified by name rather than by type. At least one attribute that represents a policy type, such as Activate or Dynamic, must be present.

See also