Skip to content

Remove interactive from F# snippet references #8216

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

Merged
merged 1 commit into from
Jul 14, 2022
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
2 changes: 1 addition & 1 deletion xml/System/ArgumentOutOfRangeException.xml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ The conditions in which an <xref:System.ArgumentOutOfRangeException> exception i
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="~/snippets/csharp/System/ArgumentOutOfRangeException/Overview/BadSearch.cs" interactive="try-dotnet" id="Snippet6":::
:::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/System.ArgumentOutOfRangeException/fs/BadSearch.fs" interactive="try-dotnet" id="Snippet6":::
:::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/System.ArgumentOutOfRangeException/fs/BadSearch.fs" id="Snippet6":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/System.ArgumentOutOfRangeException/vb/BadSearch.vb" id="Snippet6":::

To prevent the exception, check that the search is successful by making sure that the returned index is greater than or equal to zero before attempting to retrieve the item from the collection, as the following code fragment does.
Expand Down
8 changes: 4 additions & 4 deletions xml/System/String.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8705,7 +8705,7 @@ The <xref:System.Runtime.CompilerServices.CompilationRelaxations.NoStringInterni
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.string.isnullorempty/cpp/isnullorempty1.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System/String/IsNullOrEmpty/isnullorempty1.cs" interactive="try-dotnet-method" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.string.isnullorempty/vb/isnullorempty1.vb" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/System/String/IsNullOrEmpty/isnullorempty1.fs" interactive="try-dotnet-method" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/System/String/IsNullOrEmpty/isnullorempty1.fs" id="Snippet1":::

You can use the <xref:System.String.IsNullOrWhiteSpace%2A> method to test whether a string is `null`, its value is <xref:System.String.Empty?displayProperty=nameWithType>, or it consists only of white-space characters.

Expand All @@ -8716,7 +8716,7 @@ A string is `null` if it has not been assigned a value (in C++ and Visual Basic)
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.string.isnullorempty/cpp/NullString1.cpp" id="Snippet2":::
:::code language="csharp" source="~/snippets/csharp/System/String/IsNullOrEmpty/NullString1.cs" interactive="try-dotnet-method" id="Snippet2":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.string.isnullorempty/vb/NullString1.vb" id="Snippet2":::
:::code language="fsharp" source="~/snippets/fsharp/System/String/IsNullOrEmpty/NullString1.fs" interactive="try-dotnet-method" id="Snippet2":::
:::code language="fsharp" source="~/snippets/fsharp/System/String/IsNullOrEmpty/NullString1.fs" id="Snippet2":::

## What is an empty string?

Expand All @@ -8725,15 +8725,15 @@ A string is empty if it is explicitly assigned an empty string ("") or <xref:Sy
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR_System/system.string.isnullorempty/cpp/NullString1.cpp" id="Snippet3":::
:::code language="csharp" source="~/snippets/csharp/System/String/IsNullOrEmpty/NullString1.cs" interactive="try-dotnet-method" id="Snippet3":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.string.isnullorempty/vb/NullString1.vb" id="Snippet3":::
:::code language="fsharp" source="~/snippets/fsharp/System/String/IsNullOrEmpty/NullString2.fs" interactive="try-dotnet-method" id="Snippet3":::
:::code language="fsharp" source="~/snippets/fsharp/System/String/IsNullOrEmpty/NullString2.fs" id="Snippet3":::

## Examples
The following example examines three strings and determines whether each string has a value, is an empty string, or is `null`.

:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/string.isNullOrEmpty/CPP/inoe.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System/String/IsNullOrEmpty/inoe.cs" interactive="try-dotnet-method" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/string.isNullOrEmpty/VB/inoe.vb" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/System/String/IsNullOrEmpty/inoe.fs" interactive="try-dotnet-method" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/System/String/IsNullOrEmpty/inoe.fs" id="Snippet1":::

]]></format>
</remarks>
Expand Down