DisablePrivateReflectionAttribute Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Caution
DisablePrivateReflectionAttribute has no effect in .NET 6.0+.
Indicates that any private members contained in an assembly's types are not available to reflection.
public ref class DisablePrivateReflectionAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Assembly, AllowMultiple=false, Inherited=false)]
[System.Obsolete("DisablePrivateReflectionAttribute has no effect in .NET 6.0+.", DiagnosticId="SYSLIB0015", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public sealed class DisablePrivateReflectionAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.Assembly, AllowMultiple=false, Inherited=false)]
public sealed class DisablePrivateReflectionAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Assembly, AllowMultiple=false, Inherited=false)>]
[<System.Obsolete("DisablePrivateReflectionAttribute has no effect in .NET 6.0+.", DiagnosticId="SYSLIB0015", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
type DisablePrivateReflectionAttribute = class
inherit Attribute
[<System.AttributeUsage(System.AttributeTargets.Assembly, AllowMultiple=false, Inherited=false)>]
type DisablePrivateReflectionAttribute = class
inherit Attribute
Public NotInheritable Class DisablePrivateReflectionAttribute
Inherits Attribute
- Inheritance
- Attributes
Remarks
Note
The .NET Framework, .NET Core, and .NET runtimes do not consistently enforce this attribute. Developers should not rely on this attribute to restrict access to an assembly's non-public members.
Ordinarily, reflection methods, such a Type.GetMethod or PropertyInfo.GetValue, can be used to get information about private members at runtime. When applies to an assembly, the DisablePrivateReflectionAttribute attribute makes information about private members in that assembly's types unavailable to runtime reflection.
Constructors
| Name | Description |
|---|---|
| DisablePrivateReflectionAttribute() |
Initializes a new instances of the DisablePrivateReflectionAttribute class. |
Properties
| Name | Description |
|---|---|
| TypeId |
When implemented in a derived class, gets a unique identifier for this Attribute. (Inherited from Attribute) |
Methods
| Name | Description |
|---|---|
| Equals(Object) |
Returns a value that indicates whether this instance is equal to a specified object. (Inherited from Attribute) |
| GetHashCode() |
Returns the hash code for this instance. (Inherited from Attribute) |
| GetType() |
Gets the Type of the current instance. (Inherited from Object) |
| IsDefaultAttribute() |
When overridden in a derived class, indicates whether the value of this instance is the default value for the derived class. (Inherited from Attribute) |
| Match(Object) |
When overridden in a derived class, returns a value that indicates whether this instance equals a specified object. (Inherited from Attribute) |
| MemberwiseClone() |
Creates a shallow copy of the current Object. (Inherited from Object) |
| ToString() |
Returns a string that represents the current object. (Inherited from Object) |