Skip to content

Commit 85c7725

Browse files
authored
Improve code sample (dotnet#8072)
The previous code sample had inconsistent indentation and extraneous details that made it harder to see what it is trying to demonstrate.
1 parent b420625 commit 85c7725

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

snippets/csharp/System/Environment/ExpandEnvironmentVariables/expandenvironmentvariables.cs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,17 @@ class Sample
66
{
77
public static void Main()
88
{
9-
String str;
10-
String nl = Environment.NewLine;
9+
// Keep this information secure!
10+
string query = "My system drive is %SystemDrive% and my system root is %SystemRoot%";
1111

12-
Console.WriteLine();
13-
// <-- Keep this information secure! -->
14-
String query = "My system drive is %SystemDrive% and my system root is %SystemRoot%";
15-
str = Environment.ExpandEnvironmentVariables(query);
16-
Console.WriteLine("ExpandEnvironmentVariables: {0} {1}", nl, str);
12+
string str = Environment.ExpandEnvironmentVariables(query);
13+
14+
Console.WriteLine(str);
1715
}
1816
}
1917
/*
20-
This example produces the following results:
18+
This example prints:
2119
22-
ExpandEnvironmentVariables:
23-
My system drive is C: and my system root is C:\WINNT
20+
My system drive is C: and my system root is C:\WINDOWS
2421
*/
25-
//</snippet1>
22+
//</snippet1>

0 commit comments

Comments
 (0)