Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Defines policy for code elements the containing attribute is applied to.
Syntax
<AttributeImplies Activate="policy_type"
Browse="policy_type"
Dynamic="policy_type"
Serialize="policy_type"
DataContractSerializer="policy_setting"
DataContractJsonSerializer="policy_setting"
XmlSerializer="policy_setting"
MarshalObject="policy_setting"
MarshalDelegate="policy_setting"
MarshalStructure="policy_setting" />
Attributes and Elements
The following sections describe attributes, child elements, and parent elements.
Attributes
Attribute | Attribute type | Description |
---|---|---|
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.Json.DataContractJsonSerializer 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 Windows Runtime 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. |
All attributes
Value | Description |
---|---|
policy_setting | The setting to apply to this policy type. Possible values are All , Auto , Excluded , Public , PublicAndInternal , Required Public , Required PublicAndInternal , and Required All . For more information, see Runtime Directive Policy Settings. |
Child Elements
None.
Parent Elements
Element | Description |
---|---|
<Type> | Applies reflection policy to a type and all its members. |
Remarks
The <AttributeImplies>
element is used if its containing type is an attribute (that is, a class derived from System.Attribute). If the attribute is applied to a particular program element, the policy defined by the <AttributeImplies>
element applies to that program element.
The reflection, serialization, and interop attributes are all optional, although at least one should be present.