Skip to content

Commit 0ee0961

Browse files
Merge pull request #11912 from dotnet/main
Merge main into live
2 parents e2b3c07 + c336445 commit 0ee0961

File tree

8 files changed

+74
-72
lines changed

8 files changed

+74
-72
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Library</OutputType>
5+
<TargetFramework>net9.0</TargetFramework>
6+
</PropertyGroup>
7+
8+
</Project>
Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
// <Snippet1>
22
using System;
3-
using System.IO;
43
using System.Xml;
54

65
public class Sample
76
{
8-
public static void Main()
7+
public static void CreateTextNodeExample()
98
{
10-
//Create the XmlDocument.
11-
XmlDocument doc = new XmlDocument();
9+
// Create the XmlDocument.
10+
XmlDocument doc = new();
1211
doc.LoadXml("<book genre='novel' ISBN='1-861001-57-5'>" +
1312
"<title>Pride And Prejudice</title>" +
1413
"</book>");
1514

16-
//Create a new node and add it to the document.
17-
//The text node is the content of the price element.
15+
// Create a new node and add it to the document.
16+
// The text node is the content of the price element.
1817
XmlElement elem = doc.CreateElement("price");
1918
XmlText text = doc.CreateTextNode("19.95");
2019
doc.DocumentElement.AppendChild(elem);
@@ -24,14 +23,4 @@ public static void Main()
2423
doc.Save(Console.Out);
2524
}
2625
}
27-
/*
28-
The example displays the following output:
29-
30-
Display the modified XML...
31-
<?xml version="1.0" encoding="us-ascii"?>
32-
<book genre="novel" ISBN="1-861001-57-5">
33-
<title>Pride And Prejudice</title>
34-
<price>19.95</price>
35-
</book>
36-
*/
37-
// </Snippet1>
26+
// </Snippet1>

snippets/csharp/System.Xml/XmlDocument/CreateElement/source1.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
using System.IO;
44
using System.Xml;
55

6-
public class Sample {
7-
8-
public static void Main() {
9-
6+
public class Sample1
7+
{
8+
public static void CreateElementExample()
9+
{
1010
// Create the XmlDocument.
11-
XmlDocument doc = new XmlDocument();
11+
XmlDocument doc = new();
1212
string xmlData = "<book xmlns:bk='urn:samples'></book>";
1313

1414
doc.Load(new StringReader(xmlData));
@@ -22,4 +22,4 @@ public static void Main() {
2222
doc.Save(Console.Out);
2323
}
2424
}
25-
// </Snippet1>
25+
// </Snippet1>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net9.0</TargetFramework>
6+
</PropertyGroup>
7+
8+
</Project>
Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,28 @@
1-
' <Snippet1>
21
Option Explicit
32
Option Strict
4-
3+
' <Snippet1>
54
Imports System.IO
65
Imports System.Xml
76

87
Public Class Sample
9-
108
Public Shared Sub Main()
11-
'Create the XmlDocument.
9+
10+
' Create the XmlDocument.
1211
Dim doc As New XmlDocument()
1312
doc.LoadXml("<book genre='novel' ISBN='1-861001-57-5'>" & _
1413
"<title>Pride And Prejudice</title>" & _
1514
"</book>")
1615

17-
'Create a new node and add it to the document.
18-
'The text node is the content of the price element.
16+
' Create a new node and add it to the document.
17+
' The text node is the content of the price element.
1918
Dim elem As XmlElement = doc.CreateElement("price")
2019
Dim text As XmlText = doc.CreateTextNode("19.95")
2120
doc.DocumentElement.AppendChild(elem)
2221
doc.DocumentElement.LastChild.AppendChild(text)
2322

2423
Console.WriteLine("Display the modified XML...")
2524
doc.Save(Console.Out)
25+
2626
End Sub
2727
End Class
28-
' The example displays the following output:
29-
'
30-
' Display the modified XML...
31-
' <?xml version="1.0" encoding="utf-8"?>
32-
' <book genre="novel" ISBN="1-861001-57-5">
33-
' <title>Pride And Prejudice</title>
34-
' <price>19.95</price>
35-
' </book>
3628
' </Snippet1>

xml/System.Windows.Forms/ListView+SelectedListViewItemCollection.xml

Lines changed: 21 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -51,25 +51,23 @@
5151
5252
The following table shows an example of how the <xref:System.Windows.Forms.ListView.ListViewItemCollection> stores the items of the <xref:System.Windows.Forms.ListView> as well as their selection states in an example <xref:System.Windows.Forms.ListView> control.
5353
54-
|Index|Item|Selection state in the ListView|
55-
|-----------|----------|-------------------------------------|
56-
|0|Item1|Unselected|
57-
|1|Item2|Selected|
58-
|2|Item3|Unselected|
59-
|3|Item4|Selected|
60-
|4|Item5|Selected|
54+
| Index | Item | Selection state in the ListView |
55+
|-------|-------|---------------------------------|
56+
| 0 | Item1 | Unselected |
57+
| 1 | Item2 | Selected |
58+
| 2 | Item3 | Unselected |
59+
| 3 | Item4 | Selected |
60+
| 4 | Item5 | Selected |
6161
6262
Based on the <xref:System.Windows.Forms.ListView.ListViewItemCollection> example in the previous table, the following table demonstrates how the <xref:System.Windows.Forms.ListView.SelectedListViewItemCollection> would appear.
6363
64-
|Index|Selected item in the ListViewItemCollection|
65-
|-----------|-------------------------------------------------|
66-
|0|Item2|
67-
|1|Item4|
68-
|2|Item5|
64+
| Index | Selected item in the ListViewItemCollection |
65+
|-------|---------------------------------------------|
66+
| 0 | Item2 |
67+
| 1 | Item4 |
68+
| 2 | Item5 |
6969
70-
You can use the properties and methods of this class to perform a variety of tasks with the collection. The <xref:System.Windows.Forms.ListView.SelectedListViewItemCollection.Contains%2A> method enables you to determine whether an item from the <xref:System.Windows.Forms.ListView.ListViewItemCollection> class is a member of the <xref:System.Windows.Forms.ListView.SelectedListViewItemCollection>. Once you know that the item is in the collection, you can use the <xref:System.Windows.Forms.ListView.SelectedListViewItemCollection.IndexOf%2A> method to determine the position of the item in the <xref:System.Windows.Forms.ListView.SelectedListViewItemCollection>.
71-
72-
70+
You can use the properties and methods of this class to perform a variety of tasks with the collection. The <xref:System.Windows.Forms.ListView.SelectedListViewItemCollection.Contains%2A> method enables you to determine whether an item from the <xref:System.Windows.Forms.ListView.ListViewItemCollection> class is a member of the <xref:System.Windows.Forms.ListView.SelectedListViewItemCollection>. Once you know that the item is in the collection, you can use the <xref:System.Windows.Forms.ListView.SelectedListViewItemCollection.IndexOf%2A> method to determine the position of the item in the <xref:System.Windows.Forms.ListView.SelectedListViewItemCollection>.
7371
7472
## Examples
7573
The following code example demonstrates using the <xref:System.Windows.Forms.ListView.SelectedItems%2A>, <xref:System.Windows.Forms.ListView.SelectedIndexChanged> event, and <xref:System.Windows.Forms.ListView.HeaderStyle%2A> members and the <xref:System.Windows.Forms.ListView.SelectedListViewItemCollection> class. To run this example, paste the following code in a form that contains a <xref:System.Windows.Forms.ListView> object named `ListView1` and a <xref:System.Windows.Forms.TextBox> named `TextBox1`. Call the `InitializeListView` method from the form's constructor or the <xref:System.Windows.Forms.Form.Load> event handler. This example requires that the event handler is correctly associated with the <xref:System.Windows.Forms.ListView.SelectedIndexChanged> event
@@ -149,15 +147,8 @@
149147
</ReturnValue>
150148
<Parameters />
151149
<Docs>
152-
<summary>Removes all items from the collection.</summary>
153-
<remarks>
154-
<format type="text/markdown"><![CDATA[
155-
156-
## Remarks
157-
This method enables you to clear all selections from the <xref:System.Windows.Forms.ListView> control.
158-
159-
]]></format>
160-
</remarks>
150+
<summary>Clears all selections in the list view.</summary>
151+
<remarks>To be added.</remarks>
161152
</Docs>
162153
</Member>
163154
<Member MemberName="Contains">
@@ -187,7 +178,7 @@
187178
<Parameter Name="item" Type="System.Windows.Forms.ListViewItem" />
188179
</Parameters>
189180
<Docs>
190-
<param name="item">A <see cref="T:System.Windows.Forms.ListViewItem" /> representing the item to locate in the collection.</param>
181+
<param name="item">The item to locate in the collection.</param>
191182
<summary>Determines whether the specified item is located in the collection.</summary>
192183
<returns>
193184
<see langword="true" /> if the specified item is located in the collection; otherwise, <see langword="false" />.</returns>
@@ -231,7 +222,7 @@
231222
<param name="key">The name of the item to find in the collection.</param>
232223
<summary>Determines whether an item with the specified key is contained in the collection.</summary>
233224
<returns>
234-
<see langword="true" /> to indicate the specified item is contained in the collection; otherwise, <see langword="false" />.</returns>
225+
<see langword="true" /> if the specified item is contained in the collection; otherwise, <see langword="false" />.</returns>
235226
<remarks>
236227
<format type="text/markdown"><![CDATA[
237228
@@ -275,7 +266,7 @@
275266
<Parameter Name="index" Type="System.Int32" />
276267
</Parameters>
277268
<Docs>
278-
<param name="dest">An <see cref="T:System.Array" /> representing the array to copy the contents of the collection to.</param>
269+
<param name="dest">The array to copy the contents of the collection to.</param>
279270
<param name="index">The location within the destination array to copy the items from the collection to.</param>
280271
<summary>Copies the entire collection into an existing array at a specified location within the array.</summary>
281272
<remarks>
@@ -393,9 +384,9 @@
393384
<Parameter Name="item" Type="System.Windows.Forms.ListViewItem" />
394385
</Parameters>
395386
<Docs>
396-
<param name="item">A <see cref="T:System.Windows.Forms.ListViewItem" /> representing the item to locate in the collection.</param>
387+
<param name="item">The item to locate in the collection.</param>
397388
<summary>Returns the index within the collection of the specified item.</summary>
398-
<returns>The zero-based index of the item in the collection. If the item is not located in the collection, the return value is negative one (-1).</returns>
389+
<returns>The zero-based index of the item in the collection. If the item is not located in the collection, returns -1.</returns>
399390
<remarks>
400391
<format type="text/markdown"><![CDATA[
401392
@@ -783,7 +774,7 @@ This member is an explicit interface member implementation. It can be used only
783774
<Parameter Name="item" Type="System.Object" />
784775
</Parameters>
785776
<Docs>
786-
<param name="item">An object that represents the item to locate in the collection.</param>
777+
<param name="item">The item to locate in the collection.</param>
787778
<summary>Returns the index, within the collection, of the specified item.</summary>
788779
<returns>The zero-based index of the item if it is in the collection; otherwise, -1</returns>
789780
<remarks>To be added.</remarks>

xml/System.Xml/XmlDictionaryWriter.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@
183183
<Docs>
184184
<summary>To be added.</summary>
185185
<remarks>To be added.</remarks>
186+
<inheritdoc />
186187
</Docs>
187188
</Member>
188189
<MemberGroup MemberName="CreateBinaryWriter">
@@ -838,6 +839,7 @@ binarywriter.WriteEndAttribute();
838839
<param name="disposing">To be added.</param>
839840
<summary>To be added.</summary>
840841
<remarks>To be added.</remarks>
842+
<inheritdoc />
841843
</Docs>
842844
</Member>
843845
<Member MemberName="EndCanonicalization">

xml/System.Xml/XmlDocument.xml

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,6 +1029,17 @@ The following example creates a new element and adds it to the document.
10291029
[!code-csharp[Classic WebData XmlDocument.CreateElement Example#1](~/snippets/csharp/System.Xml/XmlDocument/CreateElement/source.cs#1)]
10301030
[!code-vb[Classic WebData XmlDocument.CreateElement Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/VB/source.vb#1)]
10311031
1032+
The example produces the following output:
1033+
1034+
```output
1035+
Display the modified XML...
1036+
<?xml version="1.0" encoding="utf-8"?>
1037+
<book genre="novel" ISBN="1-861001-57-5">
1038+
<title>Pride And Prejudice</title>
1039+
<price>19.95</price>
1040+
</book>
1041+
```
1042+
10321043
]]></format>
10331044
</remarks>
10341045
</Docs>
@@ -1986,21 +1997,22 @@ The following example adds significant white space to the document.
19861997
<Docs>
19871998
<param name="text">The text for the Text node.</param>
19881999
<summary>Creates an <see cref="T:System.Xml.XmlText" /> with the specified text.</summary>
1989-
<returns>The new <see langword="XmlText" /> node.</returns>
2000+
<returns>The new node.</returns>
19902001
<remarks>
19912002
<format type="text/markdown"><![CDATA[
19922003
19932004
## Remarks
1994-
Although this method creates the new object in the context of the document, it does not automatically add the new object to the document tree. To add the new object, you must explicitly call one of the node insert methods.
19952005
1996-
According to the W3C [Extensible Markup Language (XML) 1.0 recommendation](https://www.w3.org/TR/1998/REC-xml-19980210), Text nodes are only allowed within Element, Attribute and EntityReference nodes.
2006+
Although this method creates the new object in the context of the document, it does not automatically add the new object to the document tree. To add the new object, you must explicitly call one of the node insert methods.
2007+
2008+
According to the W3C [Extensible Markup Language (XML) 1.0 recommendation](https://www.w3.org/TR/1998/REC-xml-19980210), Text nodes are only allowed within Element, Attribute and EntityReference nodes.
19972009
19982010
## Examples
19992011
20002012
The following example creates a new element and adds it to the document.
20012013
2002-
[!code-csharp[Classic WebData XmlDocument.CreateElement Example#1](~/snippets/csharp/System.Xml/XmlDocument/CreateElement/source.cs#1)]
2003-
[!code-vb[Classic WebData XmlDocument.CreateElement Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/VB/source.vb#1)]
2014+
:::code language="csharp" source="~/snippets/csharp/System.Xml/XmlDocument/CreateElement/source.cs" id="Snippet1":::
2015+
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/VB/source.vb" id="Snippet1":::
20042016
20052017
]]></format>
20062018
</remarks>

0 commit comments

Comments
 (0)