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.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.