This documentation is archived and is not being maintained.

ObfuscationAttribute.ApplyToMembers Property

Note: This property is new in the .NET Framework version 2.0.

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 */
public boolean get_ApplyToMembers ()

/** @property */
public void set_ApplyToMembers (boolean value)

public function get ApplyToMembers () : boolean

public function set ApplyToMembers (value : boolean)

Property Value

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

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

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0