You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Tests/CSharp/ExpressionTests/XmlExpressionTests.cs
+12-12Lines changed: 12 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,7 @@ internal partial class TestClass
24
24
private void TestMethod()
25
25
{
26
26
string hello = ""Hello"";
27
-
XElement x = new XElement(""h1"", hello);
27
+
var x = new XElement(""h1"", hello);
28
28
}
29
29
}");
30
30
}
@@ -46,7 +46,7 @@ private void TestMethod()
46
46
{
47
47
int var1 = 1;
48
48
int var2 = 2;
49
-
XElement x = new XElement(""h1"", var1, var2, new XElement(""span"", var2, var1));
49
+
var x = new XElement(""h1"", var1, var2, new XElement(""span"", var2, var1));
50
50
}
51
51
}");
52
52
}
@@ -114,9 +114,9 @@ internal partial class TestClass
114
114
{
115
115
private void TestMethod()
116
116
{
117
-
XDocument catalog = new XDocument(new XElement(""Catalog"", new XElement(""Book"", new XAttribute(""id"", ""bk101""), new XElement(""Author"", ""Garghentini, Davide""), new XElement(""Title"", ""XML Developer's Guide""), new XElement(""Price"", ""44.95""), new XElement(""Description"", ""\r\n An in-depth look at creating applications\r\n with "", new XElement(""technology"", ""XML""), "". For\r\n "", new XElement(""audience"", ""beginners""), "" or\r\n "", new XElement(""audience"", ""advanced""), "" developers.\r\n "")), new XElement(""Book"", new XAttribute(""id"", ""bk331""), new XElement(""Author"", ""Spencer, Phil""), new XElement(""Title"", ""Developing Applications with Visual Basic .NET""), new XElement(""Price"", ""45.95""), new XElement(""Description"", ""\r\n Get the expert insights, practical code samples,\r\n and best practices you need\r\n to advance your expertise with "", new XElement(""technology"", ""Visual\r\n Basic .NET""), "".\r\n Learn how to create faster, more reliable applications\r\n based on professional,\r\n pragmatic guidance by today's top "", new XElement(""audience"", ""developers""), "".\r\n ""))));
118
-
XElement htmlOutput = new XElement(""html"", new XElement(""body"", from book in catalog.Elements(""Catalog"").Elements(""Book"")
119
-
select new XElement(""div"", new XElement(""h1"", book.Elements(""Title"").Value), new XElement(""h3"", ""By "" + book.Elements(""Author"").Value), new XElement(""h3"", ""Price = "" + book.Elements(""Price"").Value), new XElement(""h2"", ""Description""), TransformDescription((string)book.Elements(""Description"").ElementAtOrDefault(0)), new XElement(""hr""))));
117
+
var catalog = new XDocument(new XElement(""Catalog"", new XElement(""Book"", new XAttribute(""id"", ""bk101""), new XElement(""Author"", ""Garghentini, Davide""), new XElement(""Title"", ""XML Developer's Guide""), new XElement(""Price"", ""44.95""), new XElement(""Description"", ""\r\n An in-depth look at creating applications\r\n with "", new XElement(""technology"", ""XML""), "". For\r\n "", new XElement(""audience"", ""beginners""), "" or\r\n "", new XElement(""audience"", ""advanced""), "" developers.\r\n "")), new XElement(""Book"", new XAttribute(""id"", ""bk331""), new XElement(""Author"", ""Spencer, Phil""), new XElement(""Title"", ""Developing Applications with Visual Basic .NET""), new XElement(""Price"", ""45.95""), new XElement(""Description"", ""\r\n Get the expert insights, practical code samples,\r\n and best practices you need\r\n to advance your expertise with "", new XElement(""technology"", ""Visual\r\n Basic .NET""), "".\r\n Learn how to create faster, more reliable applications\r\n based on professional,\r\n pragmatic guidance by today's top "", new XElement(""audience"", ""developers""), "".\r\n ""))));
118
+
var htmlOutput = new XElement(""html"", new XElement(""body"", from book in catalog.Elements(""Catalog"").Elements(""Book"")
119
+
select new XElement(""div"", new XElement(""h1"", book.Elements(""Title"").Value), new XElement(""h3"", ""By "" + book.Elements(""Author"").Value), new XElement(""h3"", ""Price = "" + book.Elements(""Price"").Value), new XElement(""h2"", ""Description""), TransformDescription((string)book.Elements(""Description"").ElementAtOrDefault(0)), new XElement(""hr""))));
120
120
}
121
121
122
122
public string TransformDescription(string s)
@@ -145,8 +145,8 @@ internal partial class TestClass
145
145
{
146
146
private void TestMethod()
147
147
{
148
-
XElement b = new XElement(""someXmlTag"");
149
-
XElement c = new XElement(""someXmlTag"", new XElement(""bla"", new XAttribute(""anAttribute"", ""itsValue""), ""tata""), new XElement(""someContent"", ""tata""));
148
+
var b = new XElement(""someXmlTag"");
149
+
var c = new XElement(""someXmlTag"", new XElement(""bla"", new XAttribute(""anAttribute"", ""itsValue""), ""tata""), new XElement(""someContent"", ""tata""));
150
150
}
151
151
}");
152
152
}
@@ -168,7 +168,7 @@ internal partial class TestClass
168
168
private void TestMethod()
169
169
{
170
170
const string value1 = ""something"";
171
-
XElement xElement = new XElement(""Elem1"", new XAttribute(""Attr1"", value1), new XAttribute(""Attr2"", 100));
171
+
var xElement = new XElement(""Elem1"", new XAttribute(""Attr1"", value1), new XAttribute(""Attr2"", 100));
172
172
}
173
173
}");
174
174
}
@@ -188,7 +188,7 @@ internal partial class TestClass
188
188
{
189
189
private void TestMethod()
190
190
{
191
-
XElement xElement = new XElement(""Elem1"", new XAttribute(""Attr1"", ""something""));
191
+
var xElement = new XElement(""Elem1"", new XAttribute(""Attr1"", ""something""));
192
192
}
193
193
}");
194
194
}
@@ -210,7 +210,7 @@ internal partial class TestClass
210
210
{
211
211
private void TestMethod()
212
212
{
213
-
XElement xDocument = new XElement(""Test"");
213
+
var xDocument = new XElement(""Test"");
214
214
var elements1 = xDocument.Elements(""Something"").SingleOrDefault()?.Elements(""SomethingElse"");
215
215
}
216
216
}");
@@ -276,10 +276,10 @@ internal static partial class Module1
276
276
public static void Main()
277
277
{
278
278
// Create element by using the default global XML namespace.
0 commit comments