From c0279283c031cd765e4dba3dbcf668154cf96a06 Mon Sep 17 00:00:00 2001
From: Genevieve Warren <24882762+gewarren@users.noreply.github.com>
Date: Mon, 22 Jul 2024 17:14:03 -0700
Subject: [PATCH] fix various issues in response to UUF feedback
---
.../Regex/IsMatch/Project.csproj | 9 +++
.../Regex/IsMatch/ismatch1.cs | 42 ++++++------
.../Regex/IsMatch/ismatch2.cs | 42 ++++++------
.../Regex/IsMatch/ismatch3.cs | 64 ++++++++++---------
.../Regex/IsMatch/ismatch4.cs | 44 ++++++-------
.../Regex/IsMatch/ismatch5.cs | 57 +++++++++--------
xml/System.Net/HttpWebRequest.xml | 2 +-
xml/System.Windows.Forms/DataGridView.xml | 2 +-
xml/System/Char.xml | 7 +-
xml/System/Decimal.xml | 2 +-
10 files changed, 142 insertions(+), 129 deletions(-)
create mode 100644 snippets/csharp/System.Text.RegularExpressions/Regex/IsMatch/Project.csproj
diff --git a/snippets/csharp/System.Text.RegularExpressions/Regex/IsMatch/Project.csproj b/snippets/csharp/System.Text.RegularExpressions/Regex/IsMatch/Project.csproj
new file mode 100644
index 00000000000..a26e271e986
--- /dev/null
+++ b/snippets/csharp/System.Text.RegularExpressions/Regex/IsMatch/Project.csproj
@@ -0,0 +1,9 @@
+
+
+
+ Exe
+ net8.0
+ Example1
+
+
+
diff --git a/snippets/csharp/System.Text.RegularExpressions/Regex/IsMatch/ismatch1.cs b/snippets/csharp/System.Text.RegularExpressions/Regex/IsMatch/ismatch1.cs
index 98c825eab66..5ced4594f76 100644
--- a/snippets/csharp/System.Text.RegularExpressions/Regex/IsMatch/ismatch1.cs
+++ b/snippets/csharp/System.Text.RegularExpressions/Regex/IsMatch/ismatch1.cs
@@ -1,25 +1,25 @@
-//
-using System;
+using System;
using System.Text.RegularExpressions;
-public class Example
+public class Example1
{
- public static void Main()
- {
- string[] partNumbers= { "1298-673-4192", "A08Z-931-468A",
- "_A90-123-129X", "12345-KKA-1230",
- "0919-2893-1256" };
- string pattern = @"^[a-zA-Z0-9]\d{2}[a-zA-Z0-9](-\d{3}){2}[A-Za-z0-9]$";
- foreach (string partNumber in partNumbers)
- Console.WriteLine("{0} {1} a valid part number.",
- partNumber,
- Regex.IsMatch(partNumber, pattern) ? "is" : "is not");
- }
+ public static void Main()
+ {
+ //
+ string[] partNumbers = [ "1298-673-4192", "A08Z-931-468A",
+ "_A90-123-129X", "12345-KKA-1230",
+ "0919-2893-1256" ];
+ string pattern = @"^[a-zA-Z0-9]\d{2}[a-zA-Z0-9](-\d{3}){2}[A-Za-z0-9]$";
+ foreach (string partNumber in partNumbers)
+ Console.WriteLine($"{partNumber} {(Regex.IsMatch(partNumber, pattern) ? "is" : "is not")} " +
+ $"a valid part number.");
+
+ // The example displays the following output:
+ // 1298-673-4192 is a valid part number.
+ // A08Z-931-468A is a valid part number.
+ // _A90-123-129X is not a valid part number.
+ // 12345-KKA-1230 is not a valid part number.
+ // 0919-2893-1256 is not a valid part number.
+ //
+ }
}
-// The example displays the following output:
-// 1298-673-4192 is a valid part number.
-// A08Z-931-468A is a valid part number.
-// _A90-123-129X is not a valid part number.
-// 12345-KKA-1230 is not a valid part number.
-// 0919-2893-1256 is not a valid part number.
-//
diff --git a/snippets/csharp/System.Text.RegularExpressions/Regex/IsMatch/ismatch2.cs b/snippets/csharp/System.Text.RegularExpressions/Regex/IsMatch/ismatch2.cs
index 4015d494834..ded6f8b4fa5 100644
--- a/snippets/csharp/System.Text.RegularExpressions/Regex/IsMatch/ismatch2.cs
+++ b/snippets/csharp/System.Text.RegularExpressions/Regex/IsMatch/ismatch2.cs
@@ -1,25 +1,25 @@
-//
-using System;
+using System;
using System.Text.RegularExpressions;
-public class Example
+public class Example2
{
- public static void Main()
- {
- string[] partNumbers= { "1298-673-4192", "A08Z-931-468A",
- "_A90-123-129X", "12345-KKA-1230",
- "0919-2893-1256" };
- Regex rgx = new Regex(@"^[a-zA-Z0-9]\d{2}[a-zA-Z0-9](-\d{3}){2}[A-Za-z0-9]$");
- foreach (string partNumber in partNumbers)
- Console.WriteLine("{0} {1} a valid part number.",
- partNumber,
- rgx.IsMatch(partNumber) ? "is" : "is not");
- }
+ public static void Main()
+ {
+ //
+ string[] partNumbers = [ "1298-673-4192", "A08Z-931-468A",
+ "_A90-123-129X", "12345-KKA-1230",
+ "0919-2893-1256" ];
+ Regex rgx = new Regex(@"^[a-zA-Z0-9]\d{2}[a-zA-Z0-9](-\d{3}){2}[A-Za-z0-9]$");
+ foreach (string partNumber in partNumbers)
+ Console.WriteLine($"{partNumber} {(rgx.IsMatch(partNumber) ? "is" : "is not")} a valid part number.");
+
+ // The example displays the following output:
+ // 1298-673-4192 is a valid part number.
+ // A08Z-931-468A is a valid part number.
+ // _A90-123-129X is not a valid part number.
+ // 12345-KKA-1230 is not a valid part number.
+ // 0919-2893-1256 is not a valid part number.
+ //
+ }
}
-// The example displays the following output:
-// 1298-673-4192 is a valid part number.
-// A08Z-931-468A is a valid part number.
-// _A90-123-129X is not a valid part number.
-// 12345-KKA-1230 is not a valid part number.
-// 0919-2893-1256 is not a valid part number.
-//
+
diff --git a/snippets/csharp/System.Text.RegularExpressions/Regex/IsMatch/ismatch3.cs b/snippets/csharp/System.Text.RegularExpressions/Regex/IsMatch/ismatch3.cs
index 023ff2ddb0d..7afe096cecf 100644
--- a/snippets/csharp/System.Text.RegularExpressions/Regex/IsMatch/ismatch3.cs
+++ b/snippets/csharp/System.Text.RegularExpressions/Regex/IsMatch/ismatch3.cs
@@ -1,35 +1,39 @@
-//
+
using System;
using System.Text.RegularExpressions;
-public class Example
+public partial class Example3
{
- public static void Main()
- {
- string[] partNumbers= { "Part Number: 1298-673-4192", "Part No: A08Z-931-468A",
- "_A90-123-129X", "123K-000-1230",
- "SKU: 0919-2893-1256" };
- Regex rgx = new Regex(@"[a-zA-Z0-9]\d{2}[a-zA-Z0-9](-\d{3}){2}[A-Za-z0-9]$");
- foreach (string partNumber in partNumbers)
- {
- int start = partNumber.IndexOf(':');
- if (start >= 0)
- {
- Console.WriteLine("{0} {1} a valid part number.",
- partNumber,
- rgx.IsMatch(partNumber, start) ? "is" : "is not");
- }
- else
- {
- Console.WriteLine("Cannot find starting position in {0}.", partNumber);
- }
- }
- }
+ public static void Main()
+ {
+ //
+ string[] partNumbers = [ "Part Number: 1298-673-4192", "Part No: A08Z-931-468A",
+ "_A90-123-129X", "123K-000-1230",
+ "SKU: 0919-2893-1256" ];
+ Regex rgx = MyRegex();
+ foreach (string partNumber in partNumbers)
+ {
+ int start = partNumber.IndexOf(':');
+ if (start >= 0)
+ {
+ Console.WriteLine($"{partNumber} {(rgx.IsMatch(partNumber, start) ? "is" : "is not")} a valid part number.");
+ }
+ else
+ {
+ Console.WriteLine("Cannot find starting position in {0}.", partNumber);
+ }
+ }
+
+ // The example displays the following output:
+ // Part Number: 1298-673-4192 is a valid part number.
+ // Part No: A08Z-931-468A is a valid part number.
+ // Cannot find starting position in _A90-123-129X.
+ // Cannot find starting position in 123K-000-1230.
+ // SKU: 0919-2893-1256 is not a valid part number.
+ //
+ }
+
+ [GeneratedRegex(@"[a-zA-Z0-9]\d{2}[a-zA-Z0-9](-\d{3}){2}[A-Za-z0-9]$")]
+ private static partial Regex MyRegex();
}
-// The example displays the following output:
-// Part Number: 1298-673-4192 is a valid part number.
-// Part No: A08Z-931-468A is a valid part number.
-// Cannot find starting position in _A90-123-129X.
-// Cannot find starting position in 123K-000-1230.
-// SKU: 0919-2893-1256 is not a valid part number.
-//
+
diff --git a/snippets/csharp/System.Text.RegularExpressions/Regex/IsMatch/ismatch4.cs b/snippets/csharp/System.Text.RegularExpressions/Regex/IsMatch/ismatch4.cs
index fe9f3f1a485..0fe1740f8f9 100644
--- a/snippets/csharp/System.Text.RegularExpressions/Regex/IsMatch/ismatch4.cs
+++ b/snippets/csharp/System.Text.RegularExpressions/Regex/IsMatch/ismatch4.cs
@@ -1,26 +1,26 @@
-//
-using System;
+using System;
using System.Text.RegularExpressions;
-public class Example
+public class Example4
{
- public static void Main()
- {
- string[] partNumbers= { "1298-673-4192", "A08Z-931-468a",
- "_A90-123-129X", "12345-KKA-1230",
- "0919-2893-1256" };
- string pattern = @"^[A-Z0-9]\d{2}[A-Z0-9](-\d{3}){2}[A-Z0-9]$";
- foreach (string partNumber in partNumbers)
- Console.WriteLine("{0} {1} a valid part number.",
- partNumber,
- Regex.IsMatch(partNumber, pattern, RegexOptions.IgnoreCase)
- ? "is" : "is not");
- }
+ public static void Main()
+ {
+ //
+ string[] partNumbers = [ "1298-673-4192", "A08Z-931-468a",
+ "_A90-123-129X", "12345-KKA-1230",
+ "0919-2893-1256" ];
+ string pattern = @"^[A-Z0-9]\d{2}[A-Z0-9](-\d{3}){2}[A-Z0-9]$";
+ foreach (string partNumber in partNumbers)
+ Console.WriteLine("{0} {1} a valid part number.",
+ partNumber,
+ Regex.IsMatch(partNumber, pattern, RegexOptions.IgnoreCase) ? "is" : "is not");
+
+ // The example displays the following output:
+ // 1298-673-4192 is a valid part number.
+ // A08Z-931-468a is a valid part number.
+ // _A90-123-129X is not a valid part number.
+ // 12345-KKA-1230 is not a valid part number.
+ // 0919-2893-1256 is not a valid part number.
+ //
+ }
}
-// The example displays the following output:
-// 1298-673-4192 is a valid part number.
-// A08Z-931-468a is a valid part number.
-// _A90-123-129X is not a valid part number.
-// 12345-KKA-1230 is not a valid part number.
-// 0919-2893-1256 is not a valid part number.
-//
diff --git a/snippets/csharp/System.Text.RegularExpressions/Regex/IsMatch/ismatch5.cs b/snippets/csharp/System.Text.RegularExpressions/Regex/IsMatch/ismatch5.cs
index 14e0761f744..bdd3f0a6e68 100644
--- a/snippets/csharp/System.Text.RegularExpressions/Regex/IsMatch/ismatch5.cs
+++ b/snippets/csharp/System.Text.RegularExpressions/Regex/IsMatch/ismatch5.cs
@@ -1,32 +1,33 @@
-//
-using System;
+using System;
using System.Text.RegularExpressions;
-public class Example
+public class Example5
{
- public static void Main()
- {
- string[] partNumbers= { "1298-673-4192", "A08Z-931-468a",
- "_A90-123-129X", "12345-KKA-1230",
- "0919-2893-1256" };
- string pattern = @"^[A-Z0-9]\d{2}[A-Z0-9](-\d{3}){2}[A-Z0-9]$";
- foreach (string partNumber in partNumbers)
- try {
- Console.WriteLine("{0} {1} a valid part number.",
- partNumber,
- Regex.IsMatch(partNumber, pattern, RegexOptions.IgnoreCase)
- ? "is" : "is not", TimeSpan.FromMilliseconds(500));
- }
- catch (RegexMatchTimeoutException e) {
- Console.WriteLine("Timeout after {0} seconds matching {1}.",
- e.MatchTimeout, e.Input);
- }
- }
+ public static void Main()
+ {
+ //
+ string[] partNumbers = [ "1298-673-4192", "A08Z-931-468a",
+ "_A90-123-129X", "12345-KKA-1230",
+ "0919-2893-1256" ];
+ string pattern = @"^[A-Z0-9]\d{2}[A-Z0-9](-\d{3}){2}[A-Z0-9]$";
+ foreach (string partNumber in partNumbers)
+ try
+ {
+ bool isMatch = Regex.IsMatch(partNumber, pattern, RegexOptions.IgnoreCase, TimeSpan.FromMilliseconds(500));
+ Console.WriteLine($"{partNumber} {(isMatch ? "is" : "is not")} a valid part number.");
+ }
+ catch (RegexMatchTimeoutException e)
+ {
+ Console.WriteLine($"Timeout after {e.MatchTimeout} seconds matching {e.Input}.");
+ }
+
+ // The example displays the following output:
+ // 1298-673-4192 is a valid part number.
+ // A08Z-931-468a is a valid part number.
+ // _A90-123-129X is not a valid part number.
+ // 12345-KKA-1230 is not a valid part number.
+ // 0919-2893-1256 is not a valid part number.
+ //
+ }
}
-// The example displays the following output:
-// 1298-673-4192 is a valid part number.
-// A08Z-931-468a is a valid part number.
-// _A90-123-129X is not a valid part number.
-// 12345-KKA-1230 is not a valid part number.
-// 0919-2893-1256 is not a valid part number.
-//
+
diff --git a/xml/System.Net/HttpWebRequest.xml b/xml/System.Net/HttpWebRequest.xml
index 42910984d3a..0af7c6ea897 100644
--- a/xml/System.Net/HttpWebRequest.xml
+++ b/xml/System.Net/HttpWebRequest.xml
@@ -2579,7 +2579,7 @@ Both constructors are obsolete and should not b
Gets or sets the default maximum length of an HTTP error response.
- The default maximum length of an HTTP error response.
+ The default maximum length, in kilobytes (1024 bytes), of an HTTP error response.
To be added.
The value is less than 0 and is not equal to -1.
diff --git a/xml/System.Windows.Forms/DataGridView.xml b/xml/System.Windows.Forms/DataGridView.xml
index 2bcd52779c6..f3fdf803d49 100644
--- a/xml/System.Windows.Forms/DataGridView.xml
+++ b/xml/System.Windows.Forms/DataGridView.xml
@@ -3594,7 +3594,7 @@ The control replaces and extends the System.Windows.Forms.QuestionEventHandler
- Occurs when the property of a control is and the cancels edits in a row.
+ Occurs when the property of a control is and the user cancels edits in a row.
@@ -1668,13 +1667,13 @@ This determines whether the character is in the range 'A' through 'Z', inclusive
The character to evaluate.
Indicates whether a character is categorized as an uppercase ASCII letter.
- if is a lowercase ASCII letter; otherwise, .
+ if is an uppercase ASCII letter; otherwise, .
diff --git a/xml/System/Decimal.xml b/xml/System/Decimal.xml
index 1daa73085ec..a09696a45f6 100644
--- a/xml/System/Decimal.xml
+++ b/xml/System/Decimal.xml
@@ -7133,7 +7133,7 @@ It is recommended that a function return `1`, `0`, and `-1`, respectively.
The minuend.
The subtrahend.
- Subtracts one specified value from another.
+ Subtracts a specified value from another.
The result of subtracting from .