Skip to content

Commit 4da95d1

Browse files
Add usage note to DisablePrivateReflectionAttribute (#4969)
1 parent 283ef1c commit 4da95d1

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

xml/System.Runtime.CompilerServices/DisablePrivateReflectionAttribute.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@
4343
<format type="text/markdown"><![CDATA[
4444
4545
## Remarks
46+
47+
> [!NOTE]
48+
> 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.
49+
4650
Ordinarily, reflection methods, such a <xref:System.Type.GetMethod%2A?displayProperty=nameWithType> or <xref:System.Reflection.PropertyInfo.GetValue%2A?displayProperty=nameWithType>, can be used to get information about private members at runtime. When applies to an assembly, the <xref:System.Runtime.CompilerServices.DisablePrivateReflectionAttribute> attribute makes information about private members in that assembly's types unavailable to runtime reflection.
4751
4852
]]></format>

0 commit comments

Comments
 (0)