Skip to content

.NET Interactive: Enable_try_dotnet_to_batch_13c #4472

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 8, 2020
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
10 changes: 5 additions & 5 deletions xml/System.Globalization/DateTimeFormatInfo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2209,8 +2209,8 @@ Changing the value of this property affects the following properties as well: <x
## Remarks
The <xref:System.Globalization.DateTimeFormatInfo.LongDatePattern%2A> property defines the culture-specific format of date strings that are returned by calls to the <xref:System.DateTime.ToString%2A?displayProperty=nameWithType> and <xref:System.DateTimeOffset.ToString%2A?displayProperty=nameWithType> methods and by composite format strings that are supplied the "D" standard format string. The following example illustrates the relationships among the following: the "D" standard format string, the custom format string returned by the <xref:System.Globalization.DateTimeFormatInfo.LongDatePattern%2A> property, and the culture-specific representation of a date.

[!code-csharp[System.Globalization.DateTimeFormatInfo.LongDatePattern#2](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.LongDatePattern/CS/longdatepattern1.cs#2)]
[!code-vb[System.Globalization.DateTimeFormatInfo.LongDatePattern#2](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.LongDatePattern/VB/longdatepattern1.vb#2)]
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.LongDatePattern/CS/longdatepattern1.cs" interactive="try-dotnet" id="Snippet2":::
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.LongDatePattern/VB/longdatepattern1.vb" id="Snippet2":::

See [Custom Date and Time Format Strings](~/docs/standard/base-types/custom-date-and-time-format-strings.md) for individual custom format specifiers that can be combined to construct custom format strings such as "dddd, dd MMMM yyyy".

Expand All @@ -2226,9 +2226,9 @@ Changing the value of this property affects the following properties as well: <x
## Examples
The following example displays the value of the <xref:System.Globalization.DateTimeFormatInfo.LongDatePattern%2A> property for a few cultures.

[!code-cpp[System.Globalization.DateTimeFormatInfo.LongDatePattern#1](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.LongDatePattern/CPP/dtfi_longdatepattern.cpp#1)]
[!code-csharp[System.Globalization.DateTimeFormatInfo.LongDatePattern#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.LongDatePattern/CS/dtfi_longdatepattern.cs#1)]
[!code-vb[System.Globalization.DateTimeFormatInfo.LongDatePattern#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.LongDatePattern/VB/dtfi_longdatepattern.vb#1)]
:::code language="cpp" source="~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.LongDatePattern/CPP/dtfi_longdatepattern.cpp" id="Snippet1":::
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.LongDatePattern/CS/dtfi_longdatepattern.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.LongDatePattern/VB/dtfi_longdatepattern.vb" id="Snippet1":::

]]></format>
</remarks>
Expand Down
4 changes: 2 additions & 2 deletions xml/System.Linq/Queryable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2138,8 +2138,8 @@
## Examples
The following code example demonstrates how to use <xref:System.Linq.Queryable.Contains%60%601%28System.Linq.IQueryable%7B%60%600%7D%2C%60%600%29> to determine whether a sequence contains a specific element.

[!code-csharp[System.Linq.Queryable#21](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Linq.Queryable/CS/queryable.cs#21)]
[!code-vb[System.Linq.Queryable#21](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Linq.Queryable/VB/queryable.vb#21)]
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Linq.Queryable/CS/queryable.cs" interactive="try-dotnet-method" id="Snippet21":::
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Linq.Queryable/VB/queryable.vb" id="Snippet21":::

]]></format>
</remarks>
Expand Down
6 changes: 3 additions & 3 deletions xml/System.Security.Cryptography/Oid.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@
## Examples
The following code example shows how to use the <xref:System.Security.Cryptography.Oid> class.

[!code-cpp[Cryptography.Oid#1](~/samples/snippets/cpp/VS_Snippets_CLR/Cryptography.Oid/CPP/cryptography.oid.cpp#1)]
[!code-csharp[Cryptography.Oid#1](~/samples/snippets/csharp/VS_Snippets_CLR/Cryptography.Oid/CS/cryptography.oid.cs#1)]
[!code-vb[Cryptography.Oid#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/Cryptography.Oid/VB/cryptography.oid.vb#1)]
:::code language="cpp" source="~/samples/snippets/cpp/VS_Snippets_CLR/Cryptography.Oid/CPP/cryptography.oid.cpp" id="Snippet1":::
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR/Cryptography.Oid/CS/cryptography.oid.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR/Cryptography.Oid/VB/cryptography.oid.vb" id="Snippet1":::

]]></format>
</remarks>
Expand Down
6 changes: 3 additions & 3 deletions xml/System.Security.Cryptography/RNGCryptoServiceProvider.xml
Original file line number Diff line number Diff line change
Expand Up @@ -391,9 +391,9 @@
## Examples
The following code example shows how to create a random number with the <xref:System.Security.Cryptography.RNGCryptoServiceProvider> class.

[!code-cpp[RNGCSP#1](~/samples/snippets/cpp/VS_Snippets_CLR/RNGCSP/cpp/rngcsp.cpp#1)]
[!code-csharp[RNGCSP#1](~/samples/snippets/csharp/VS_Snippets_CLR/RNGCSP/CS/rngcsp.cs#1)]
[!code-vb[RNGCSP#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/RNGCSP/VB/rngcsp.vb#1)]
:::code language="cpp" source="~/samples/snippets/cpp/VS_Snippets_CLR/RNGCSP/cpp/rngcsp.cpp" id="Snippet1":::
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR/RNGCSP/CS/rngcsp.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR/RNGCSP/VB/rngcsp.vb" id="Snippet1":::

]]></format>
</remarks>
Expand Down
6 changes: 3 additions & 3 deletions xml/System/Array.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3915,9 +3915,9 @@
## Examples
The following code example shows how to use <xref:System.Array.GetEnumerator%2A> to list the elements of an array.

[!code-cpp[System.Array_GetEnumerator#1](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Array_GetEnumerator/CPP/array_getenumerator.cpp#1)]
[!code-csharp[System.Array_GetEnumerator#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Array_GetEnumerator/CS/array_getenumerator.cs#1)]
[!code-vb[System.Array_GetEnumerator#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Array_GetEnumerator/VB/array_getenumerator.vb#1)]
:::code language="cpp" source="~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Array_GetEnumerator/CPP/array_getenumerator.cpp" id="Snippet1":::
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Array_GetEnumerator/CS/array_getenumerator.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Array_GetEnumerator/VB/array_getenumerator.vb" id="Snippet1":::

]]></format>
</remarks>
Expand Down
18 changes: 9 additions & 9 deletions xml/System/Func`4.xml
Original file line number Diff line number Diff line change
Expand Up @@ -101,22 +101,22 @@

When you use the <xref:System.Func%604> delegate, you do not have to explicitly define a delegate that encapsulates a method with three parameters. For example, the following code explicitly declares a generic delegate named `ParseNumber` and assigns a reference to the <xref:System.Int32.Parse%2A> method to its delegate instance.

[!code-csharp[System.Func~4#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Func~4/cs/Delegate.cs#1)]
[!code-vb[System.Func~4#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Func~4/vb/Delegate.vb#1)]
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Func~4/cs/Delegate.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Func~4/vb/Delegate.vb" id="Snippet1":::

The following example simplifies this code by instantiating the <xref:System.Func%604> delegate instead of explicitly defining a new delegate and assigning a named method to it.

[!code-csharp[System.Func~4#2](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Func~4/cs/Func4.cs#2)]
[!code-vb[System.Func~4#2](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Func~4/vb/Func4.vb#2)]
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Func~4/cs/Func4.cs" interactive="try-dotnet" id="Snippet2":::
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Func~4/vb/Func4.vb" id="Snippet2":::

You can use the <xref:System.Func%604> delegate with anonymous methods in C#, as the following example illustrates. (For an introduction to anonymous methods, see [Anonymous Methods](~/docs/csharp/programming-guide/statements-expressions-operators/anonymous-methods.md).)

[!code-csharp[System.Func~4#3](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Func~4/cs/Anon.cs#3)]
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Func~4/cs/Anon.cs" interactive="try-dotnet" id="Snippet3":::

You can also assign a lambda expression to a <xref:System.Func%604> delegate, as the following example illustrates. (For an introduction to lambda expressions, see [Lambda Expressions](~/docs/visual-basic/programming-guide/language-features/procedures/lambda-expressions.md) and [Lambda Expressions](~/docs/csharp/programming-guide/statements-expressions-operators/lambda-expressions.md).)

[!code-csharp[System.Func~4#4](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Func~4/cs/Lambda.cs#4)]
[!code-vb[System.Func~4#4](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Func~4/vb/Lambda.vb#4)]
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Func~4/cs/Lambda.cs" interactive="try-dotnet" id="Snippet4":::
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Func~4/vb/Lambda.vb" id="Snippet4":::

The underlying type of a lambda expression is one of the generic `Func` delegates. This makes it possible to pass a lambda expression as a parameter without explicitly assigning it to a delegate. In particular, because many methods of types in the <xref:System.Linq> namespace have `Func` parameters, you can pass these methods a lambda expression without explicitly instantiating a `Func` delegate.

Expand All @@ -125,8 +125,8 @@
## Examples
The following example demonstrates how to declare and use a <xref:System.Func%603> delegate. This example declares a <xref:System.Func%603> variable and assigns it a lambda expression that takes a <xref:System.String> value and an <xref:System.Int32> value as parameters. The lambda expression returns `true` if the length of the <xref:System.String> parameter is equal to the value of the <xref:System.Int32> parameter. The delegate that encapsulates this method is subsequently used in a query to filter strings in an array of strings.

[!code-csharp[System.Func~3#5](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Func~3/cs/Example.cs#5)]
[!code-vb[System.Func~3#5](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Func~3/vb/Example.vb#5)]
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Func~3/cs/Example.cs" interactive="try-dotnet" id="Snippet5":::
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Func~3/vb/Example.vb" id="Snippet5":::

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