ObfuscationAttribute::Exclude Property

 

Gets or sets a Boolean value indicating whether the obfuscation tool should exclude the type or member from obfuscation.

Namespace:   System.Reflection
Assembly:  mscorlib (in mscorlib.dll)

public:
property bool Exclude {
	bool get();
	void set(bool value);
}

Property Value

Type: System::Boolean

true if the type or member to which this attribute is applied should be excluded from obfuscation; otherwise, false. The default is true.

System_CAPS_importantImportant

Applying this attribute does not automatically obfuscate the code entity to which you apply it. Applying the attribute is an alternative to creating a configuration file for the obfuscation tool. That is, it merely provides instructions for an obfuscation tool. Microsoft recommends that vendors of obfuscation tools follow the semantics described here. However, there is no guarantee that a particular tool follows Microsoft recommendations.

The following code example shows a type that is marked to be excluded from obfuscation. It is not necessary to specify the Exclude property, because it defaults to true, but specifying it explicitly makes your intent clear. The ApplyToMembers is set to false, so that the exclusion from obfuscation does not apply to the members of the class. That is, the class name is visible but the members are obfuscated.

The MethodA method is marked with the value "default" for the Feature property. It is necessary to specify false for the Exclude property in order to avoid excluding MethodA from obfuscation, because the default for the Exclude property is true. The StripAfterObfuscation property is false so that the obfuscation tool will not strip the attribute after obfuscation.

This code is part of a larger example that can be compiled and executed. See the ObfuscationAttribute class.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 2.0
Return to top
Show: