-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
System.ArgumentOutOfRangeException F# snippets #7429
Conversation
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. |
@dsyme could you review this? |
@BillWagner ready for merge |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
:::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"::: |
There was a problem hiding this comment.
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.
Summary
Adds F# code snippets for ArgumentOutOfRangeException