ObfuscationAttribute.Exclude 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取或设置一个 Boolean 值,该值指示模糊处理工具是否应将类型或成员从模糊处理中排除。
public:
property bool Exclude { bool get(); void set(bool value); };
public bool Exclude { get; set; }
member this.Exclude : bool with get, set
Public Property Exclude As Boolean
属性值
如果应用该特性的类型或成员应从模糊处理中排除,则为 true
;否则为 false
。 默认值为 true
。
示例
下面的代码示例显示标记为从模糊处理中排除的类型。 不需要指定 Exclude 属性,因为它默认为 true
,但指定该属性会明确表示意向。 false
设置为 ApplyToMembers ,以便模糊处理中的排除不适用于类的成员。 也就是说,类名可见,但成员被模糊处理。
该方法MethodA
使用属性的值"default"
Feature进行标记。 必须为属性指定false
,以避免从模糊处理中排除MethodA
,因为属性的Exclude默认值为 true
。Exclude 该 StripAfterObfuscation 属性 false
使模糊处理工具在模糊处理后不会去除该属性。
此代码是可以编译和执行的大型示例的一部分。 请参阅 ObfuscationAttribute 类。
[ObfuscationAttribute(Exclude=true, ApplyToMembers=false)]
public class Type2
{
// The exclusion of the type is not applied to its members,
// however in order to mark the member with the "default"
// feature it is necessary to specify Exclude=false,
// because the default value of Exclude is true. The tool
// should not strip this attribute after obfuscation.
[ObfuscationAttribute(Exclude=false, Feature="default",
StripAfterObfuscation=false)]
public void MethodA() {}
// This member is marked for obfuscation, because the
// exclusion of the type is not applied to its members.
public void MethodB() {}
}
<ObfuscationAttribute(Exclude:=True, ApplyToMembers:=False)> _
Public Class Type2
' The exclusion of the type is not applied to its members,
' however in order to mark the member with the "default"
' feature it is necessary to specify Exclude:=False,
' because the default value of Exclude is True. The tool
' should not strip this attribute after obfuscation.
<ObfuscationAttribute(Exclude:=False, _
Feature:="default", StripAfterObfuscation:=False)> _
Public Sub MethodA()
End Sub
' This member is marked for obfuscation, because the
' exclusion of the type is not applied to its members.
Public Sub MethodB()
End Sub
End Class
注解
重要
应用此属性不会自动模糊处理向其应用它的代码实体。 应用该属性是为模糊处理工具创建配置文件的替代方法。 也就是说,它只是提供模糊处理工具的说明。 Microsoft 建议混淆工具供应商遵循此处所述的语义。 但是,不能保证特定工具遵循 Microsoft 建议。