Skip to content

Commit b002899

Browse files
v-mepamairaw
andauthored
.NET Interactive: Enable_try_dotnet_to_batch_11c (#4374)
* enable_try_dotnet_to_batch_11c * remove_extra_line * Update xml/System/Exception.xml Co-authored-by: Maira Wenzel <[email protected]> Co-authored-by: Maira Wenzel <[email protected]>
1 parent 944505c commit b002899

File tree

5 files changed

+28
-28
lines changed

5 files changed

+28
-28
lines changed

xml/System/DateTime.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1595,9 +1595,9 @@ The behavior of the .NET Framework and COM means that if your application round-
15951595
## Examples
15961596
The following example uses the <xref:System.DateTime.AddDays%2A> method to determine the day of the week 36 days after the current date.
15971597

1598-
[!code-cpp[DateTime.AddDays#1](~/samples/snippets/cpp/VS_Snippets_CLR/DateTime.AddDays/CPP/class1.cpp#1)]
1599-
[!code-csharp[DateTime.AddDays#1](~/samples/snippets/csharp/VS_Snippets_CLR/DateTime.AddDays/CS/class1.cs#1)]
1600-
[!code-vb[DateTime.AddDays#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/DateTime.AddDays/VB/class1.vb#1)]
1598+
:::code language="cpp" source="~/samples/snippets/cpp/VS_Snippets_CLR/DateTime.AddDays/CPP/class1.cpp" id="Snippet1":::
1599+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR/DateTime.AddDays/CS/class1.cs" interactive="try-dotnet" id="Snippet1":::
1600+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR/DateTime.AddDays/VB/class1.vb" id="Snippet1":::
16011601

16021602
]]></format>
16031603
</remarks>
@@ -2520,9 +2520,9 @@ The behavior of the .NET Framework and COM means that if your application round-
25202520
## Examples
25212521
The following example demonstrates the <xref:System.DateTime.DayOfWeek%2A> property and the <xref:System.DayOfWeek?displayProperty=nameWithType> enumeration.
25222522

2523-
[!code-cpp[DateTime.DayOfWeek#1](~/samples/snippets/cpp/VS_Snippets_CLR/DateTime.DayOfWeek/CPP/dow.cpp#1)]
2524-
[!code-csharp[DateTime.DayOfWeek#1](~/samples/snippets/csharp/VS_Snippets_CLR/DateTime.DayOfWeek/CS/dow.cs#1)]
2525-
[!code-vb[DateTime.DayOfWeek#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/DateTime.DayOfWeek/VB/dow.vb#1)]
2523+
:::code language="cpp" source="~/samples/snippets/cpp/VS_Snippets_CLR/DateTime.DayOfWeek/CPP/dow.cpp" id="Snippet1":::
2524+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR/DateTime.DayOfWeek/CS/dow.cs" interactive="try-dotnet" id="Snippet1":::
2525+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR/DateTime.DayOfWeek/VB/dow.vb" id="Snippet1":::
25262526

25272527
]]></format>
25282528
</remarks>

xml/System/Enum.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3396,8 +3396,8 @@ thisInstance And flag = flag
33963396
## Examples
33973397
The following example defines a `Colors` enumeration, calls the <xref:System.Enum.TryParse%60%601%28System.String%2C%60%600%40%29> method to convert strings to their corresponding enumeration values, and calls the <xref:System.Enum.IsDefined%2A> method to ensure that particular integral values are underlying values in the `Colors` enumeration.
33983398
3399-
[!code-csharp[System.Enum.TryParse#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.enum.tryparse/cs/tryparse1.cs#1)]
3400-
[!code-vb[System.Enum.TryParse#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.enum.tryparse/vb/tryparse1.vb#1)]
3399+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.enum.tryparse/cs/tryparse1.cs" interactive="try-dotnet" id="Snippet1":::
3400+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.enum.tryparse/vb/tryparse1.vb" id="Snippet1":::
34013401
34023402
]]></format>
34033403
</remarks>
@@ -3481,8 +3481,8 @@ thisInstance And flag = flag
34813481
## Examples
34823482
The following example defines a `Colors` enumeration, calls the <xref:System.Enum.TryParse%60%601%28System.String%2CSystem.Boolean%2C%60%600%40%29> method to convert strings to their corresponding enumeration values, and calls the <xref:System.Enum.IsDefined%2A> method to ensure that particular integral values are underlying values in the `Colors` enumeration. The <xref:System.Enum.TryParse%60%601%28System.String%2CSystem.Boolean%2C%60%600%40%29> method uses case-insensitive comparison when trying to convert the string representations of named constants to their equivalent enumeration values.
34833483
3484-
[!code-csharp[System.Enum.TryParse#2](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.enum.tryparse/cs/tryparse2.cs#2)]
3485-
[!code-vb[System.Enum.TryParse#2](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.enum.tryparse/vb/tryparse2.vb#2)]
3484+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.enum.tryparse/cs/tryparse2.cs" interactive="try-dotnet" id="Snippet2":::
3485+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.enum.tryparse/vb/tryparse2.vb" id="Snippet2":::
34863486
34873487
]]></format>
34883488
</remarks>

xml/System/Exception.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,9 +1091,9 @@ Stack Trace:
10911091
## Examples
10921092
The following code example throws and then catches an <xref:System.Exception> exception and displays the exception's text message using the <xref:System.Exception.Message%2A> property.
10931093
1094-
[!code-cpp[System.Exception.Properties#1](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Properties/CPP/properties.cpp#1)]
1095-
[!code-csharp[System.Exception.Properties#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Exception.Properties/CS/properties.cs#1)]
1096-
[!code-vb[System.Exception.Properties#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Exception.Properties/VB/properties.vb#1)]
1094+
:::code language="cpp" source="~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Properties/CPP/properties.cpp" id="Snippet1":::
1095+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Exception.Properties/CS/properties.cs" interactive="try-dotnet" id="Snippet1":::
1096+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Exception.Properties/VB/properties.vb" id="Snippet1":::
10971097
10981098
]]></format>
10991099
</remarks>
@@ -1295,9 +1295,9 @@ Stack Trace:
12951295
## Examples
12961296
The following code example throws an `Exception` and then catches it and displays a stack trace using the `StackTrace` property.
12971297
1298-
[!code-cpp[System.Exception.Properties#1](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Properties/CPP/properties.cpp#1)]
1299-
[!code-csharp[System.Exception.Properties#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Exception.Properties/CS/properties.cs#1)]
1300-
[!code-vb[System.Exception.Properties#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Exception.Properties/VB/properties.vb#1)]
1298+
:::code language="cpp" source="~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Properties/CPP/properties.cpp" id="Snippet1":::
1299+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Exception.Properties/CS/properties.cs" interactive="try-dotnet" id="Snippet1":::
1300+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Exception.Properties/VB/properties.vb" id="Snippet1":::
13011301
13021302
]]></format>
13031303
</remarks>

xml/System/FlagsAttribute.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,17 +88,17 @@
8888
## Examples
8989
The following example illustrates the use of the `FlagsAttribute` attribute and shows the effect on the <xref:System.Enum.ToString%2A> method of using `FlagsAttribute` on an <xref:System.Enum> declaration.
9090
91-
[!code-cpp[System.FlagsAttribute#1](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.FlagsAttribute/CPP/flags.cpp#1)]
92-
[!code-csharp[System.FlagsAttribute#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.FlagsAttribute/CS/flags.cs#1)]
93-
[!code-vb[System.FlagsAttribute#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.FlagsAttribute/VB/flags.vb#1)]
91+
:::code language="cpp" source="~/samples/snippets/cpp/VS_Snippets_CLR_System/system.FlagsAttribute/CPP/flags.cpp" id="Snippet1":::
92+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.FlagsAttribute/CS/flags.cs" interactive="try-dotnet" id="Snippet1":::
93+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.FlagsAttribute/VB/flags.vb" id="Snippet1":::
9494
9595
The preceding example defines two color-related enumerations, `SingleHue` and `MultiHue`. The latter has the `FlagsAttribute` attribute; the former does not. The example shows the difference in behavior when a range of integers, including integers that do not represent underlying values of the enumeration type, are cast to the enumeration type and their string representations displayed. For example, note that 3 cannot be represented as a `SingleHue` value because 3 is not the underlying value of any `SingleHue` member, whereas the `FlagsAttribute` attribute makes it possible to represent 3 as a `MultiHue` value of `Black, Red`.
9696
9797
The following example defines another enumeration with the `FlagsAttribute` attribute and shows how to use bitwise logical and equality operators to determine whether one or more bit fields are set in an enumeration value. You can also use the <xref:System.Enum.HasFlag%2A?displayProperty=nameWithType> method to do that, but that is not shown in this example.
9898
99-
[!code-cpp[System.FlagsAttribute#2](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.FlagsAttribute/CPP/flags1.cpp#2)]
100-
[!code-csharp[System.FlagsAttribute#2](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.FlagsAttribute/CS/flags1.cs#2)]
101-
[!code-vb[System.FlagsAttribute#2](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.FlagsAttribute/VB/flags1.vb#2)]
99+
:::code language="cpp" source="~/samples/snippets/cpp/VS_Snippets_CLR_System/system.FlagsAttribute/CPP/flags1.cpp" id="Snippet2":::
100+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.FlagsAttribute/CS/flags1.cs" interactive="try-dotnet" id="Snippet2":::
101+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.FlagsAttribute/VB/flags1.vb" id="Snippet2":::
102102
103103
]]></format>
104104
</remarks>

xml/System/Predicate`1.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,21 +64,21 @@
6464
6565
Typically, the <xref:System.Predicate%601> delegate is represented by a lambda expression. Because locally scoped variables are available to the lambda expression, it is easy to test for a condition that is not precisely known at compile time. This is simulated in the following example, which defines a `HockeyTeam` class that contains information about a National Hockey League team and the year in which it was founded. The example defines an array of integer values that represent years, and randomly assigns one element of the array to `foundedBeforeYear`, which is a variable that is locally scoped to the example's `Main` method. Because locally scoped variables are available to a lambda expression, the lambda expression passed to the <xref:System.Collections.Generic.List%601.FindAll%2A?displayProperty=nameWithType> method is able to return a `HockeyTeam` object for each team founded on or before that year.
6666
67-
[!code-csharp[System.Predicate\`1#3](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Predicate`1/cs/predicate1.cs#3)]
68-
[!code-vb[System.Predicate\`1#3](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Predicate`1/vb/predicate1.vb#3)]
67+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Predicate`1/cs/predicate1.cs" interactive="try-dotnet" id="Snippet3":::
68+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Predicate`1/vb/predicate1.vb" id="Snippet3":::
6969
7070
7171
7272
## Examples
7373
The following code example uses a <xref:System.Predicate%601> delegate with the <xref:System.Array.Find%2A?displayProperty=nameWithType> method to search an array of <xref:System.Drawing.Point> structures. The example explicitly defines a <xref:System.Predicate%601> delegate named `predicate` and assigns it a method named `FindPoints` that returns `true` if the product of the <xref:System.Drawing.Point.X%2A?displayProperty=nameWithType> and <xref:System.Drawing.Point.Y%2A?displayProperty=nameWithType> fields is greater than 100,000. Note that it is customary to use a lambda expression rather than to explicitly define a delegate of type <xref:System.Predicate%601>, as the second example illustrates.
7474
75-
[!code-csharp[System.Predicate\`1#4](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Predicate`1/cs/predicateex2.cs#4)]
76-
[!code-vb[System.Predicate\`1#4](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Predicate`1/vb/predicateex2.vb#4)]
75+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Predicate`1/cs/predicateex2.cs" interactive="try-dotnet" id="Snippet4":::
76+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Predicate`1/vb/predicateex2.vb" id="Snippet4":::
7777
7878
The following example is identical to the previous example, except that it uses a lambda expression to represent the <xref:System.Predicate%601> delegate. Each element of the `points` array is passed to the lambda expression until the expression finds an element that meets the search criteria. In this case, the lambda expression returns `true` if the product of the X and Y fields is greater than 100,000.
7979
80-
[!code-csharp[System.Predicate\`1#2](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Predicate`1/cs/predicateex1.cs#2)]
81-
[!code-vb[System.Predicate\`1#2](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Predicate`1/vb/predicateex1.vb#2)]
80+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Predicate`1/cs/predicateex1.cs" interactive="try-dotnet" id="Snippet2":::
81+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Predicate`1/vb/predicateex1.vb" id="Snippet2":::
8282
8383
]]></format>
8484
</remarks>

0 commit comments

Comments
 (0)