Thanks to visit codestin.com
Credit goes to github.com

Skip to content

System.ArgumentOutOfRangeException F# snippets #7429

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

Conversation

albert-du
Copy link
Contributor

Summary

Adds F# code snippets for ArgumentOutOfRangeException

@ghost
Copy link

ghost commented Nov 27, 2021

I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label.

@opbld32
Copy link

opbld32 commented Nov 27, 2021

Docs Build status updates of commit 410ef6e:

✅ Validation status: passed

File Status Preview URL Details
samples/snippets/fsharp/VS_Snippets_CLR/ArgumentOutOfRangeException/FS/FS.fsproj ✅Succeeded
samples/snippets/fsharp/VS_Snippets_CLR/ArgumentOutOfRangeException/FS/program.fs ✅Succeeded View
samples/snippets/fsharp/VS_Snippets_CLR_System/System.ArgumentOutOfRangeException/fs/BadSearch.fs ✅Succeeded View
samples/snippets/fsharp/VS_Snippets_CLR_System/System.ArgumentOutOfRangeException/fs/EmptyString1.fs ✅Succeeded View
samples/snippets/fsharp/VS_Snippets_CLR_System/System.ArgumentOutOfRangeException/fs/FindWords1.fs ✅Succeeded View
samples/snippets/fsharp/VS_Snippets_CLR_System/System.ArgumentOutOfRangeException/fs/NoElements.fs ✅Succeeded View
samples/snippets/fsharp/VS_Snippets_CLR_System/System.ArgumentOutOfRangeException/fs/NoElements2.fs ✅Succeeded View
samples/snippets/fsharp/VS_Snippets_CLR_System/System.ArgumentOutOfRangeException/fs/NoFind1.fs ✅Succeeded View
samples/snippets/fsharp/VS_Snippets_CLR_System/System.ArgumentOutOfRangeException/fs/NoFind2.fs ✅Succeeded View
samples/snippets/fsharp/VS_Snippets_CLR_System/System.ArgumentOutOfRangeException/fs/OOR1.fs ✅Succeeded View
samples/snippets/fsharp/VS_Snippets_CLR_System/System.ArgumentOutOfRangeException/fs/OOR2.fs ✅Succeeded View
samples/snippets/fsharp/VS_Snippets_CLR_System/System.ArgumentOutOfRangeException/fs/Race1.fs ✅Succeeded View
samples/snippets/fsharp/VS_Snippets_CLR_System/System.ArgumentOutOfRangeException/fs/Race2.fs ✅Succeeded View
samples/snippets/fsharp/VS_Snippets_CLR_System/System.ArgumentOutOfRangeException/fs/argumentoutofrangeexception.fsproj ✅Succeeded
xml/System/ArgumentOutOfRangeException.xml ✅Succeeded View

For more details, please refer to the build report.

Note: Broken links written as relative paths are included in the above build report. For broken links written as absolute paths or external URLs, see the broken link report.

For any questions, please:

@albert-du albert-du marked this pull request as ready for review November 27, 2021 07:01
@albert-du albert-du requested a review from a team as a code owner November 27, 2021 07:01
@albert-du
Copy link
Contributor Author

@dsyme could you review this?

@BillWagner BillWagner requested a review from dsyme November 29, 2021 21:32
@albert-du
Copy link
Contributor Author

@baronfel @dsyme Could you review?

@albert-du
Copy link
Contributor Author

@BillWagner ready for merge

Copy link
Member

@BillWagner BillWagner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@BillWagner BillWagner merged commit b2e9db0 into dotnet:main Jan 18, 2022
@albert-du albert-du deleted the system-ArgumentOutOfRangeException-fsharp-snippets branch January 19, 2022 20:45
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/System.ArgumentOutOfRangeException/vb/NoElements2.vb" id="Snippet14":::

3. You're attempting to retrieve an item whose index is negative. This usually occurs because you've searched a collection for the index of a particular element and have erroneously assumed that the search is successful. In the following example, the call to the <xref:System.Collections.Generic.List%601.FindIndex%28System.Predicate%7B%600%7D%29?displayProperty=nameWithType> method fails to find a string equal to "Z" and so returns -1. However, this is an invalid index value.

:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/System.ArgumentOutOfRangeException/cs/BadSearch.cs" interactive="try-dotnet" id="Snippet6":::
:::code language="fsharp" source="~/samples/snippets/fsharp/VS_Snippets_CLR_System/System.ArgumentOutOfRangeException/fs/BadSearch.fs" interactive="try-dotnet" id="Snippet6":::
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing this was a copy/paste error, but F# doesn't support Try.NET. I will remove this in a separate PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants