SecurityPermissionAttribute.SerializationFormatter 属性
获取或设置一个值,该值指示代码是否可以使用序列化格式化程序来序列化或反序列化对象。
**命名空间:**System.Security.Permissions
**程序集:**mscorlib(在 mscorlib.dll 中)
语法
声明
Public Property SerializationFormatter As Boolean
用法
Dim instance As SecurityPermissionAttribute
Dim value As Boolean
value = instance.SerializationFormatter
instance.SerializationFormatter = value
public bool SerializationFormatter { get; set; }
public:
property bool SerializationFormatter {
bool get ();
void set (bool value);
}
/** @property */
public boolean get_SerializationFormatter ()
/** @property */
public void set_SerializationFormatter (boolean value)
public function get SerializationFormatter () : boolean
public function set SerializationFormatter (value : boolean)
属性值
如果代码可以使用序列化格式化程序来序列化或反序列化对象,则为 true,否则为 false。
示例
下面的代码示例演示如何使用 SerializationFormatter 属性拒绝序列化或反序列化对象的能力。有关完整的代码示例,请参见 SecurityPermissionAttribute 类。
' Set the Assertion,UnmanagedCode, ControlAppDomain, ControlDomainPolicy, ontrolEvidence,
' ControlPolicy, ControlPrincipal, ControlThread, Execution, Flags, Infrastructure,
' RemotingConfiguration, SerializationFormatter, and SkipVerification properties.
<SecurityPermissionAttribute(SecurityAction.Deny, Assertion:=True), _
SecurityPermissionAttribute(SecurityAction.Deny, ControlAppDomain:=True), _
SecurityPermissionAttribute(SecurityAction.Deny, ControlDomainPolicy:=True), _
SecurityPermissionAttribute(SecurityAction.Deny, ControlEvidence:=True), _
SecurityPermissionAttribute(SecurityAction.Deny, ControlPolicy:=True), _
SecurityPermissionAttribute(SecurityAction.Deny, ControlPrincipal:=True), _
SecurityPermissionAttribute(SecurityAction.Deny, ControlThread:=True), _
SecurityPermissionAttribute(SecurityAction.Deny, Execution:=True), _
SecurityPermissionAttribute(SecurityAction.Deny, Flags:=SecurityPermissionFlag.NoFlags), _
SecurityPermissionAttribute(SecurityAction.Deny, Infrastructure:=True), _
SecurityPermissionAttribute(SecurityAction.Deny, RemotingConfiguration:=True), _
SecurityPermissionAttribute(SecurityAction.Deny, SerializationFormatter:=True), _
SecurityPermissionAttribute(SecurityAction.Deny, SkipVerification:=True), _
SecurityPermissionAttribute(SecurityAction.Deny, UnmanagedCode:=True)> _
Public Shared Sub DenySecurityPermissions()
// Set the SerializationFormatter property.
[SecurityPermissionAttribute(SecurityAction.Deny, SerializationFormatter = true)]
// Set the SerializationFormatter property.
[SecurityPermissionAttribute(SecurityAction::Deny,SerializationFormatter=true)]
// Set the SerializationFormatter property.
/** @attribute SecurityPermissionAttribute(SecurityAction.Deny,
SerializationFormatter = true)
*/
平台
Windows 98、Windows 2000 SP4、Windows Millennium Edition、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition
.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求。
版本信息
.NET Framework
受以下版本支持:2.0、1.1、1.0
请参见
参考
SecurityPermissionAttribute 类
SecurityPermissionAttribute 成员
System.Security.Permissions 命名空间