-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
Syntax Error in array parenthesis in C# official doc #41000
Labels
doc-bug
Problem with the content; needs to be fixed [org][type][category]
okr-quality
Content-quality KR: Concerns article defects (bugs), freshness, or build warnings.
Pri3
📌 seQUESTered
Identifies that an issue has been imported into Quest.
Comments
Hey, check this article on arrays and its note on collection expressions. It is valid code, but it requires C# 12 and it seems sample runner doesn't support that. You will be able to run the code locally with .NET 8. |
BillWagner
added a commit
that referenced
this issue
May 21, 2024
Fixes #41000 This one sample uses an array, and is run in the try.net syntax.
BillWagner
added
the
doc-bug
Problem with the content; needs to be fixed [org][type][category]
label
May 21, 2024
I did open a PR to fix this so that it runs in the online sandbox. Note: I'll make a set of updates once the service is updated with the C# 12 bits. |
dotnet-policy-service
bot
added
the
okr-quality
Content-quality KR: Concerns article defects (bugs), freshness, or build warnings.
label
May 21, 2024
Thank you for your email!
I understand that now
Thanks!
…On Tue, May 21, 2024 at 10:19 AM Bill Wagner ***@***.***> wrote:
I did open a PR to fix this so that it runs in the online sandbox.
Note: I'll make a set of updates once the service is updated with the C#
12 bits.
—
Reply to this email directly, view it on GitHub
<#41000 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIADIVUFE24UBYA7CMALTOTZDNJXNAVCNFSM6AAAAABH5DCC2CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMRSG42DQOJTG4>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
ohh thanks
I understand now!
…On Mon, May 20, 2024 at 3:22 PM Daniel Tsvetkov ***@***.***> wrote:
Hey, check this article on arrays
<https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/arrays>
and its note on collection expressions.
It is valid code, but it requires C# 12 and it seems sample runner doesn't
support that. You will be able to run the code locally with .NET 8.
—
Reply to this email directly, view it on GitHub
<#41000 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIADIVQACWNDLKYJ3X4PEH3ZDJEQ7AVCNFSM6AAAAABH5DCC2CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMRRGA2TQOJWGM>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
sequestor
bot
added
📌 seQUESTered
Identifies that an issue has been imported into Quest.
and removed
🗺️ reQUEST
Triggers an issue to be imported into Quest.
labels
May 22, 2024
BillWagner
added a commit
that referenced
this issue
May 28, 2024
Fixes #41000 This one sample uses an array, and is run in the try.net syntax.
github-project-automation
bot
moved this from 🔖 Ready
to ✅ Done
in dotnet/docs May 2024 sprint
May 28, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
doc-bug
Problem with the content; needs to be fixed [org][type][category]
okr-quality
Content-quality KR: Concerns article defects (bugs), freshness, or build warnings.
Pri3
📌 seQUESTered
Identifies that an issue has been imported into Quest.
Describe the issue or suggestion
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/value-tuples#code-try-3
there are syntax errors on the declaration
must be corrected int[] xs = {4,7,9};
int[] ys = {-9, 0, 67, 100};
int[] xs = [4, 7, 9];
var limits = FindMinMax(xs);
Console.WriteLine($"Limits of [{string.Join(" ", xs)}] are {limits.min} and {limits.max}");
// Output:
// Limits of [4 7 9] are 4 and 9
int[] ys = [-9, 0, 67, 100];
var (minimum, maximum) = FindMinMax(ys);
Console.WriteLine($"Limits of [{string.Join(" ", ys)}] are {minimum} and {maximum}");
// Output:
// Limits of [-9 0 67 100] are -9 and 100
(int min, int max) FindMinMax(int[] input)
{
if (input is null || input.Length == 0)
{
throw new ArgumentException("Cannot find minimum and maximum of a null or empty array.");
}
}
Associated WorkItem - 256835
The text was updated successfully, but these errors were encountered: