diff --git a/snippets/csharp/System.Xml/XmlDocument/CreateElement/project.csproj b/snippets/csharp/System.Xml/XmlDocument/CreateElement/project.csproj new file mode 100644 index 00000000000..fc3f09ab482 --- /dev/null +++ b/snippets/csharp/System.Xml/XmlDocument/CreateElement/project.csproj @@ -0,0 +1,8 @@ + + + + Library + net9.0 + + + diff --git a/snippets/csharp/System.Xml/XmlDocument/CreateElement/source.cs b/snippets/csharp/System.Xml/XmlDocument/CreateElement/source.cs index d27cfe01c1a..a02b0c2a98f 100644 --- a/snippets/csharp/System.Xml/XmlDocument/CreateElement/source.cs +++ b/snippets/csharp/System.Xml/XmlDocument/CreateElement/source.cs @@ -1,20 +1,19 @@ // using System; -using System.IO; using System.Xml; public class Sample { - public static void Main() + public static void CreateTextNodeExample() { - //Create the XmlDocument. - XmlDocument doc = new XmlDocument(); + // Create the XmlDocument. + XmlDocument doc = new(); doc.LoadXml("" + "Pride And Prejudice" + ""); - //Create a new node and add it to the document. - //The text node is the content of the price element. + // Create a new node and add it to the document. + // The text node is the content of the price element. XmlElement elem = doc.CreateElement("price"); XmlText text = doc.CreateTextNode("19.95"); doc.DocumentElement.AppendChild(elem); @@ -24,14 +23,4 @@ public static void Main() doc.Save(Console.Out); } } -/* - The example displays the following output: - - Display the modified XML... - - - Pride And Prejudice - 19.95 - -*/ - // +// diff --git a/snippets/csharp/System.Xml/XmlDocument/CreateElement/source1.cs b/snippets/csharp/System.Xml/XmlDocument/CreateElement/source1.cs index 63e9b82ba49..b38ef398686 100644 --- a/snippets/csharp/System.Xml/XmlDocument/CreateElement/source1.cs +++ b/snippets/csharp/System.Xml/XmlDocument/CreateElement/source1.cs @@ -3,12 +3,12 @@ using System.IO; using System.Xml; -public class Sample { - - public static void Main() { - +public class Sample1 +{ + public static void CreateElementExample() + { // Create the XmlDocument. - XmlDocument doc = new XmlDocument(); + XmlDocument doc = new(); string xmlData = ""; doc.Load(new StringReader(xmlData)); @@ -22,4 +22,4 @@ public static void Main() { doc.Save(Console.Out); } } - // +// diff --git a/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/VB/project.vbproj b/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/VB/project.vbproj new file mode 100644 index 00000000000..92e46ddaccf --- /dev/null +++ b/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/VB/project.vbproj @@ -0,0 +1,8 @@ + + + + Exe + net9.0 + + + diff --git a/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/VB/source.vb b/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/VB/source.vb index 7d3a4454539..cbd84431153 100644 --- a/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/VB/source.vb +++ b/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/VB/source.vb @@ -1,21 +1,20 @@ -' Option Explicit Option Strict - +' Imports System.IO Imports System.Xml Public Class Sample - Public Shared Sub Main() - 'Create the XmlDocument. + + ' Create the XmlDocument. Dim doc As New XmlDocument() doc.LoadXml("" & _ "Pride And Prejudice" & _ "") - 'Create a new node and add it to the document. - 'The text node is the content of the price element. + ' Create a new node and add it to the document. + ' The text node is the content of the price element. Dim elem As XmlElement = doc.CreateElement("price") Dim text As XmlText = doc.CreateTextNode("19.95") doc.DocumentElement.AppendChild(elem) @@ -23,14 +22,7 @@ Public Class Sample Console.WriteLine("Display the modified XML...") doc.Save(Console.Out) + End Sub End Class -' The example displays the following output: -' -' Display the modified XML... -' -' -' Pride And Prejudice -' 19.95 -' ' diff --git a/xml/System.Windows.Forms/ListView+SelectedListViewItemCollection.xml b/xml/System.Windows.Forms/ListView+SelectedListViewItemCollection.xml index c2133e6e112..bd6a281ab59 100644 --- a/xml/System.Windows.Forms/ListView+SelectedListViewItemCollection.xml +++ b/xml/System.Windows.Forms/ListView+SelectedListViewItemCollection.xml @@ -51,25 +51,23 @@ The following table shows an example of how the stores the items of the as well as their selection states in an example control. -|Index|Item|Selection state in the ListView| -|-----------|----------|-------------------------------------| -|0|Item1|Unselected| -|1|Item2|Selected| -|2|Item3|Unselected| -|3|Item4|Selected| -|4|Item5|Selected| +| Index | Item | Selection state in the ListView | +|-------|-------|---------------------------------| +| 0 | Item1 | Unselected | +| 1 | Item2 | Selected | +| 2 | Item3 | Unselected | +| 3 | Item4 | Selected | +| 4 | Item5 | Selected | Based on the example in the previous table, the following table demonstrates how the would appear. -|Index|Selected item in the ListViewItemCollection| -|-----------|-------------------------------------------------| -|0|Item2| -|1|Item4| -|2|Item5| +| Index | Selected item in the ListViewItemCollection | +|-------|---------------------------------------------| +| 0 | Item2 | +| 1 | Item4 | +| 2 | Item5 | - You can use the properties and methods of this class to perform a variety of tasks with the collection. The method enables you to determine whether an item from the class is a member of the . Once you know that the item is in the collection, you can use the method to determine the position of the item in the . - - +You can use the properties and methods of this class to perform a variety of tasks with the collection. The method enables you to determine whether an item from the class is a member of the . Once you know that the item is in the collection, you can use the method to determine the position of the item in the . ## Examples The following code example demonstrates using the , event, and members and the class. To run this example, paste the following code in a form that contains a object named `ListView1` and a named `TextBox1`. Call the `InitializeListView` method from the form's constructor or the event handler. This example requires that the event handler is correctly associated with the event @@ -149,15 +147,8 @@ - Removes all items from the collection. - - control. - - ]]> - + Clears all selections in the list view. + To be added. @@ -187,7 +178,7 @@ - A representing the item to locate in the collection. + The item to locate in the collection. Determines whether the specified item is located in the collection. if the specified item is located in the collection; otherwise, . @@ -231,7 +222,7 @@ The name of the item to find in the collection. Determines whether an item with the specified key is contained in the collection. - to indicate the specified item is contained in the collection; otherwise, . + if the specified item is contained in the collection; otherwise, . - An representing the array to copy the contents of the collection to. + The array to copy the contents of the collection to. The location within the destination array to copy the items from the collection to. Copies the entire collection into an existing array at a specified location within the array. @@ -393,9 +384,9 @@ - A representing the item to locate in the collection. + The item to locate in the collection. Returns the index within the collection of the specified item. - 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). + The zero-based index of the item in the collection. If the item is not located in the collection, returns -1. - An object that represents the item to locate in the collection. + The item to locate in the collection. Returns the index, within the collection, of the specified item. The zero-based index of the item if it is in the collection; otherwise, -1 To be added. diff --git a/xml/System.Xml/XmlDictionaryWriter.xml b/xml/System.Xml/XmlDictionaryWriter.xml index 1d79ccd3f8e..3239e5c6927 100644 --- a/xml/System.Xml/XmlDictionaryWriter.xml +++ b/xml/System.Xml/XmlDictionaryWriter.xml @@ -183,6 +183,7 @@ To be added. To be added. + @@ -838,6 +839,7 @@ binarywriter.WriteEndAttribute(); To be added. To be added. To be added. + diff --git a/xml/System.Xml/XmlDocument.xml b/xml/System.Xml/XmlDocument.xml index 7810a8d92f8..14c9f42933b 100644 --- a/xml/System.Xml/XmlDocument.xml +++ b/xml/System.Xml/XmlDocument.xml @@ -1029,6 +1029,17 @@ The following example creates a new element and adds it to the document. [!code-csharp[Classic WebData XmlDocument.CreateElement Example#1](~/snippets/csharp/System.Xml/XmlDocument/CreateElement/source.cs#1)] [!code-vb[Classic WebData XmlDocument.CreateElement Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/VB/source.vb#1)] +The example produces the following output: + +```output +Display the modified XML... + + + Pride And Prejudice + 19.95 + +``` + ]]> @@ -1986,21 +1997,22 @@ The following example adds significant white space to the document. The text for the Text node. Creates an with the specified text. - The new node. + The new node.