Skip to content

Commit 2a42230

Browse files
authored
Fix code formatting (dotnet#10236)
The previous code had broken indentation, making it harder to read than necessary.
1 parent e11219f commit 2a42230

File tree

1 file changed

+23
-22
lines changed

1 file changed

+23
-22
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,29 @@
11
using System;
22
using System.ComponentModel;
3-
//using System.Diagnostics;
43

5-
namespace Win32Exception_CS
6-
{
7-
class Class1 {
8-
static void Main(string[] args) {
4+
namespace Win32Exception_CS;
95

10-
//<snippet1>
11-
try {
12-
System.Diagnostics.Process myProc = new System.Diagnostics.Process();
13-
myProc.StartInfo.FileName = "c:\nonexist.exe"; //Attempting to start a non-existing executable
14-
myProc.Start(); //Start the application and assign it to the process component.
15-
}
16-
catch(Win32Exception w) {
17-
Console.WriteLine(w.Message);
18-
Console.WriteLine(w.ErrorCode.ToString());
19-
Console.WriteLine(w.NativeErrorCode.ToString());
20-
Console.WriteLine(w.StackTrace);
21-
Console.WriteLine(w.Source);
22-
Exception e=w.GetBaseException();
23-
Console.WriteLine(e.Message);
24-
}
25-
//</snippet1>
26-
}
6+
class Class1
7+
{
8+
static void Main(string[] args)
9+
{
10+
//<snippet1>
11+
try
12+
{
13+
System.Diagnostics.Process myProc = new();
14+
myProc.StartInfo.FileName = @"c:\nonexist.exe"; // Attempt to start a non-existent executable
15+
myProc.Start();
16+
}
17+
catch (Win32Exception w)
18+
{
19+
Console.WriteLine(w.Message);
20+
Console.WriteLine(w.ErrorCode.ToString());
21+
Console.WriteLine(w.NativeErrorCode.ToString());
22+
Console.WriteLine(w.StackTrace);
23+
Console.WriteLine(w.Source);
24+
Exception e = w.GetBaseException();
25+
Console.WriteLine(e.Message);
26+
}
27+
//</snippet1>
2728
}
2829
}

0 commit comments

Comments
 (0)