From dfa02549388f3e80168c057f117a3170f40f79e8 Mon Sep 17 00:00:00 2001 From: Connor O'Shea Date: Mon, 27 Oct 2025 12:52:23 -0400 Subject: [PATCH 1/4] Use Path.Combine and Environment.NewLine --- .../System.Diagnostics/FileVersionInfo/Overview/source.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snippets/csharp/System.Diagnostics/FileVersionInfo/Overview/source.cs b/snippets/csharp/System.Diagnostics/FileVersionInfo/Overview/source.cs index 6df7bcfa20a..677c733cb1c 100644 --- a/snippets/csharp/System.Diagnostics/FileVersionInfo/Overview/source.cs +++ b/snippets/csharp/System.Diagnostics/FileVersionInfo/Overview/source.cs @@ -11,10 +11,10 @@ public static void Main(string[] args) // Get the file version for the notepad. // Use either of the two following commands. FileVersionInfo.GetVersionInfo(Path.Combine(Environment.SystemDirectory, "Notepad.exe")); - FileVersionInfo myFileVersionInfo = FileVersionInfo.GetVersionInfo(Environment.SystemDirectory + "\\Notepad.exe"); + FileVersionInfo myFileVersionInfo = FileVersionInfo.GetVersionInfo(Path.Combine(Environment.SystemDirectory, "Notepad.exe")); // Print the file name and version number. - Console.WriteLine("File: " + myFileVersionInfo.FileDescription + '\n' + + Console.WriteLine("File: " + myFileVersionInfo.FileDescription + Environment.NewLine + "Version number: " + myFileVersionInfo.FileVersion); } } From 185baa11b90876e71ddf48e3f9ff04c633b6887c Mon Sep 17 00:00:00 2001 From: Connor O'Shea Date: Mon, 27 Oct 2025 12:53:54 -0400 Subject: [PATCH 2/4] Use Path.Combine and Environment.NewLine vbLf is not defined --- .../System.Diagnostics/FileVersionInfo/Overview/source.vb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/snippets/visualbasic/System.Diagnostics/FileVersionInfo/Overview/source.vb b/snippets/visualbasic/System.Diagnostics/FileVersionInfo/Overview/source.vb index e8a8d0435c8..fcaca06aeae 100644 --- a/snippets/visualbasic/System.Diagnostics/FileVersionInfo/Overview/source.vb +++ b/snippets/visualbasic/System.Diagnostics/FileVersionInfo/Overview/source.vb @@ -10,13 +10,13 @@ Class Class1 ' Get the file version for the notepad. ' Use either of the following two commands. FileVersionInfo.GetVersionInfo(Path.Combine(Environment.SystemDirectory, "Notepad.exe")) - Dim myFileVersionInfo As FileVersionInfo = FileVersionInfo.GetVersionInfo(Environment.SystemDirectory + "\Notepad.exe") + Dim myFileVersionInfo As FileVersionInfo = FileVersionInfo.GetVersionInfo(Path.Combine(Environment.SystemDirectory, "Notepad.exe")) ' Print the file name and version number. - Console.WriteLine("File: " + myFileVersionInfo.FileDescription + vbLf + "Version number: " + myFileVersionInfo.FileVersion) + Console.WriteLine("File: " + myFileVersionInfo.FileDescription + Environment.NewLine + "Version number: " + myFileVersionInfo.FileVersion) End Sub End Class -' \ No newline at end of file +' From d2d6d534518112a83892eacda29996e28f9300e8 Mon Sep 17 00:00:00 2001 From: Connor O'Shea Date: Mon, 27 Oct 2025 20:37:29 -0400 Subject: [PATCH 3/4] Remove unnecessary example Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com> --- .../System.Diagnostics/FileVersionInfo/Overview/source.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/snippets/csharp/System.Diagnostics/FileVersionInfo/Overview/source.cs b/snippets/csharp/System.Diagnostics/FileVersionInfo/Overview/source.cs index 677c733cb1c..fa905b751bd 100644 --- a/snippets/csharp/System.Diagnostics/FileVersionInfo/Overview/source.cs +++ b/snippets/csharp/System.Diagnostics/FileVersionInfo/Overview/source.cs @@ -9,8 +9,6 @@ class Class1 public static void Main(string[] args) { // Get the file version for the notepad. - // Use either of the two following commands. - FileVersionInfo.GetVersionInfo(Path.Combine(Environment.SystemDirectory, "Notepad.exe")); FileVersionInfo myFileVersionInfo = FileVersionInfo.GetVersionInfo(Path.Combine(Environment.SystemDirectory, "Notepad.exe")); // Print the file name and version number. From cd6e576d302b40a47664817b0258e4547f1792c9 Mon Sep 17 00:00:00 2001 From: Connor O'Shea Date: Mon, 27 Oct 2025 20:37:36 -0400 Subject: [PATCH 4/4] Remove unnecessary example Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com> --- .../System.Diagnostics/FileVersionInfo/Overview/source.vb | 2 -- 1 file changed, 2 deletions(-) diff --git a/snippets/visualbasic/System.Diagnostics/FileVersionInfo/Overview/source.vb b/snippets/visualbasic/System.Diagnostics/FileVersionInfo/Overview/source.vb index fcaca06aeae..cdde0d9eebe 100644 --- a/snippets/visualbasic/System.Diagnostics/FileVersionInfo/Overview/source.vb +++ b/snippets/visualbasic/System.Diagnostics/FileVersionInfo/Overview/source.vb @@ -8,8 +8,6 @@ Class Class1 Public Shared Sub Main(ByVal args() As String) ' Get the file version for the notepad. - ' Use either of the following two commands. - FileVersionInfo.GetVersionInfo(Path.Combine(Environment.SystemDirectory, "Notepad.exe")) Dim myFileVersionInfo As FileVersionInfo = FileVersionInfo.GetVersionInfo(Path.Combine(Environment.SystemDirectory, "Notepad.exe"))