ApplyToMembers Property
Collapse the table of content
Expand the table of content

ObfuscationAttribute.ApplyToMembers Property


Gets or sets a Boolean value indicating whether the attribute of a type is to apply to the members of the type.

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

public bool ApplyToMembers { get; set; }

Property Value

Type: System.Boolean

true if the attribute is to apply to the members of the type; otherwise, false. The default is true.

The value of this property is ignored when the attribute is applied to a member.


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 excluded from obfuscation, but the exclusion does not apply to its members because the ApplyToMembers property is false.

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

[ObfuscationAttribute(Exclude=true, ApplyToMembers=false)]
public class Type2

.NET Framework
Available since 2.0
Return to top
© 2016 Microsoft