Skip to content

Commit a123b2e

Browse files
authored
add note about untrusted data (dotnet#8717)
1 parent ae8da68 commit a123b2e

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

xml/System.Resources/ResXDataNode.xml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,15 @@
3333
<remarks>
3434
<format type="text/markdown"><![CDATA[
3535
36-
## Remarks
36+
## Remarks
37+
38+
[!INCLUDE [untrusted-data-class-note](~/includes/untrusted-data-class-note.md)]
39+
3740
The <xref:System.Resources.ResXDataNode> class supports the representation of rich data types within a resource file. It can support the storage of any object in a resource file, so long as the object supports serialization and type editors.
3841
3942
You can create a <xref:System.Resources.ResXDataNode> object by calling one of its overloaded class constructors. You can then add the resource item or element to a resource file by calling the <xref:System.Resources.ResXResourceWriter.AddResource%2A?displayProperty=nameWithType> method.
4043
41-
To retrieve an existing <xref:System.Resources.ResXDataNode> object, you must enumerate the <xref:System.Resources.ResXDataNode> objects in an XML resource file by instantiating a <xref:System.Resources.ResXResourceReader> object, setting the <xref:System.Resources.ResXResourceReader.UseResXDataNodes%2A?displayProperty=nameWithType> property to `true`, and calling the <xref:System.Resources.ResXResourceReader.GetEnumerator%2A?displayProperty=nameWithType> method to get an enumerator. The example provides an illustration.
42-
43-
44+
To retrieve an existing <xref:System.Resources.ResXDataNode> object, you must enumerate the <xref:System.Resources.ResXDataNode> objects in an XML resource file by instantiating a <xref:System.Resources.ResXResourceReader> object, setting the <xref:System.Resources.ResXResourceReader.UseResXDataNodes%2A?displayProperty=nameWithType> property to `true`, and calling the <xref:System.Resources.ResXResourceReader.GetEnumerator%2A?displayProperty=nameWithType> method to get an enumerator. The example provides an illustration.
4445
4546
## Examples
4647
The following example uses the <xref:System.Resources.ResXResourceReader.GetEnumerator%2A?displayProperty=nameWithType> method to obtain an <xref:System.Collections.IDictionaryEnumerator> object that is used to enumerate the <xref:System.Resources.ResXDataNode> objects in a .resx file. The example includes a `CreateResourceFile` routine that creates the necessary XML resource file.
@@ -52,7 +53,7 @@
5253
5354
]]></format>
5455
</remarks>
55-
<related type="Article" href="https://msdn.microsoft.com/library/f7570c09-7db5-44f2-983a-e8859caeb0d5">Serialization in the .NET Framework</related>
56+
<related type="Article" href="/dotnet/standard/serialization/">Serialization in .NET</related>
5657
</Docs>
5758
<Members>
5859
<MemberGroup MemberName=".ctor">

xml/System.Resources/ResXResourceReader.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@
3636
<remarks>
3737
<format type="text/markdown"><![CDATA[
3838
39-
## Remarks
39+
## Remarks
40+
41+
[!INCLUDE [untrusted-data-class-note](~/includes/untrusted-data-class-note.md)]
42+
4043
The <xref:System.Resources.ResXResourceReader> class provides a default implementation of the <xref:System.Resources.IResourceReader> interface that reads resource information in an XML format. To read resource information from a binary resource format, use the <xref:System.Resources.ResourceReader> class.
4144
4245
You use the <xref:System.Resources.ResXResourceReader> class to enumerate resources in .resx files by traversing the dictionary enumerator (<xref:System.Collections.IDictionaryEnumerator>) that is returned by the <xref:System.Resources.ResXResourceReader.GetEnumerator%2A> method. You call the methods provided by <xref:System.Collections.IDictionaryEnumerator> to advance to the next resource and to read the name and value of each resource in the .resx file.

xml/System.Resources/ResXResourceSet.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@
2323
<remarks>
2424
<format type="text/markdown"><![CDATA[
2525
26-
## Remarks
26+
## Remarks
27+
28+
[!INCLUDE [untrusted-data-class-note](~/includes/untrusted-data-class-note.md)]
29+
2730
The <xref:System.Resources.ResXResourceSet> class enumerates over an <xref:System.Resources.IResourceReader>, loads every name and value, and stores them in a hash table. You can then enumerate the resources in the <xref:System.Resources.ResXResourceSet> object or retrieve individual resources by name.
2831
2932
A <xref:System.Resources.ResXResourceSet> object provides a convenient way to read all the resources in a .resx file into memory. You can use the <xref:System.Resources.ResourceSet.GetObject%2A> method to retrieve a particular resource when the .resx file has been read into a <xref:System.Resources.ResXResourceSet> instance.

0 commit comments

Comments
 (0)