Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix various issues in response to UUF feedback #10138

Merged
merged 1 commit into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<StartupObject>Example1</StartupObject>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
// <Snippet1>
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()
{
// <Snippet1>
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.
// </Snippet1>
}
}
// 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.
// </Snippet1>
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
// <Snippet2>
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()
{
// <Snippet2>
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.
// </Snippet2>
}
}
// 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.
// </Snippet2>

Original file line number Diff line number Diff line change
@@ -1,35 +1,39 @@
// <Snippet3>

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()
{
// <Snippet3>
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.
// </Snippet3>
}

[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.
// </Snippet3>

Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
// <Snippet4>
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()
{
// <Snippet4>
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.
// </Snippet4>
}
}
// 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.
// </Snippet4>
Original file line number Diff line number Diff line change
@@ -1,32 +1,33 @@
// <Snippet5>
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()
{
// <Snippet5>
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.
// </Snippet5>
}
}
// 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.
// </Snippet5>

2 changes: 1 addition & 1 deletion xml/System.Net/HttpWebRequest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2579,7 +2579,7 @@ Both <xref:System.Net.HttpWebRequest> constructors are obsolete and should not b
</ReturnValue>
<Docs>
<summary>Gets or sets the default maximum length of an HTTP error response.</summary>
<value>The default maximum length of an HTTP error response.</value>
<value>The default maximum length, in kilobytes (1024 bytes), of an HTTP error response.</value>
gewarren marked this conversation as resolved.
Show resolved Hide resolved
<remarks>To be added.</remarks>
<exception cref="T:System.ArgumentOutOfRangeException">The value is less than 0 and is not equal to -1.</exception>
</Docs>
Expand Down
2 changes: 1 addition & 1 deletion xml/System.Windows.Forms/DataGridView.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3594,7 +3594,7 @@ The <xref:System.Windows.Forms.DataGridView> control replaces and extends the <x
<ReturnType>System.Windows.Forms.QuestionEventHandler</ReturnType>
</ReturnValue>
<Docs>
<summary>Occurs when the <see cref="P:System.Windows.Forms.DataGridView.VirtualMode" /> property of a <see cref="T:System.Windows.Forms.DataGridView" /> control is <see langword="true" /> and the cancels edits in a row.</summary>
<summary>Occurs when the <see cref="P:System.Windows.Forms.DataGridView.VirtualMode" /> property of a <see cref="T:System.Windows.Forms.DataGridView" /> control is <see langword="true" /> and the user cancels edits in a row.</summary>
<remarks>
<format type="text/markdown"><![CDATA[

Expand Down
7 changes: 3 additions & 4 deletions xml/System/Char.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1631,8 +1631,7 @@ This determines whether the character is in the range 'a' through 'z', inclusive

## Remarks

This determines whether the character is in the range 'A' through 'Z', inclusive,
'a' through 'z', inclusive, or '0' through '9', inclusive.
This determines whether the character is in the range 'A' through 'Z', inclusive, 'a' through 'z', inclusive, or '0' through '9', inclusive.

]]></format>
</remarks>
Expand Down Expand Up @@ -1668,13 +1667,13 @@ This determines whether the character is in the range 'A' through 'Z', inclusive
<param name="c">The character to evaluate.</param>
<summary>Indicates whether a character is categorized as an uppercase ASCII letter.</summary>
<returns>
<see langword="true" /> if <paramref name="c" /> is a lowercase ASCII letter; otherwise, <see langword="false" />.</returns>
<see langword="true" /> if <paramref name="c" /> is an uppercase ASCII letter; otherwise, <see langword="false" />.</returns>
<remarks>
<format type="text/markdown"><![CDATA[

## Remarks

This determines whether the character is in the range 'a' through 'z', inclusive.
This determines whether the character is in the range 'A' through 'Z', inclusive.

]]></format>
</remarks>
Expand Down
2 changes: 1 addition & 1 deletion xml/System/Decimal.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7133,7 +7133,7 @@ It is recommended that a function return `1`, `0`, and `-1`, respectively.
<Docs>
<param name="d1">The minuend.</param>
<param name="d2">The subtrahend.</param>
<summary>Subtracts one specified <see cref="T:System.Decimal" /> value from another.</summary>
<summary>Subtracts a specified <see cref="T:System.Decimal" /> value from another.</summary>
<returns>The result of subtracting <paramref name="d2" /> from <paramref name="d1" />.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
Expand Down