Skip to content

Commit 64710f5

Browse files
authored
add_try_dotnet (dotnet#5446)
1 parent 38420d2 commit 64710f5

File tree

4 files changed

+24
-24
lines changed

4 files changed

+24
-24
lines changed

xml/System.Globalization/NumberFormatInfo.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -529,10 +529,10 @@
529529
## Examples
530530
The following example demonstrates the effect of changing the <xref:System.Globalization.NumberFormatInfo.CurrencyDecimalDigits%2A> property.
531531
532-
[!code-cpp[CurrencyDecimalDigits#1](~/samples/snippets/cpp/VS_Snippets_CLR/CurrencyDecimalDigits/CPP/currencydecimaldigits.cpp#1)]
533-
[!code-csharp[CurrencyDecimalDigits#1](~/samples/snippets/csharp/VS_Snippets_CLR/CurrencyDecimalDigits/CS/currencydecimaldigits.cs#1)]
534-
[!code-vb[CurrencyDecimalDigits#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/CurrencyDecimalDigits/VB/currencydecimaldigits.vb#1)]
535-
532+
:::code language="cpp" source="~/samples/snippets/cpp/VS_Snippets_CLR/CurrencyDecimalDigits/CPP/currencydecimaldigits.cpp" id="Snippet1":::
533+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR/CurrencyDecimalDigits/CS/currencydecimaldigits.cs" interactive="try-dotnet" id="Snippet1":::
534+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR/CurrencyDecimalDigits/VB/currencydecimaldigits.vb" id="Snippet1":::
535+
536536
]]></format>
537537
</remarks>
538538
<exception cref="T:System.ArgumentOutOfRangeException">The property is being set to a value that is less than 0 or greater than 99.</exception>

xml/System/Array.xml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,9 @@
196196
## Examples
197197
The following example wraps an array in a read-only <xref:System.Collections.ObjectModel.ReadOnlyCollection%601>.
198198

199-
[!code-cpp[System.Array.AsReadOnly#1](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Array.AsReadOnly/CPP/arrayasreadonly.cpp#1)]
200-
[!code-csharp[System.Array.AsReadOnly#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Array.AsReadOnly/CS/arrayasreadonly.cs#1)]
201-
[!code-vb[System.Array.AsReadOnly#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Array.AsReadOnly/VB/arrayasreadonly.vb#1)]
199+
:::code language="cpp" source="~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Array.AsReadOnly/CPP/arrayasreadonly.cpp" id="Snippet1":::
200+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Array.AsReadOnly/CS/arrayasreadonly.cs" interactive="try-dotnet" id="Snippet1":::
201+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Array.AsReadOnly/VB/arrayasreadonly.vb" id="Snippet1":::
202202

203203
]]></format>
204204
</remarks>
@@ -10208,13 +10208,13 @@ This property implements the <xref:System.Collections.ICollection?displayPropert
1020810208
## Examples
1020910209
The following example determines whether the last character of each element in a string array is a number. It creates two string arrays. The first array includes both strings that end with alphabetic characters and strings that end with numeric characters. The second array consists only of strings that end with numeric characters. The example also defines an `EndWithANumber` method whose signature matches the <xref:System.Predicate%601> delegate. The example passes each array to the <xref:System.Array.TrueForAll%2A> method along with a delegate that represents the `EndsWithANumber` method.
1021010210

10211-
[!code-csharp[System.Array.TrueForAll#2](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.array.trueforall/cs/trueforall2.cs#2)]
10212-
[!code-vb[System.Array.TrueForAll#2](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.array.trueforall/vb/trueforall2.vb#2)]
10211+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.array.trueforall/cs/trueforall2.cs" interactive="try-dotnet" id="Snippet2":::
10212+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.array.trueforall/vb/trueforall2.vb" id="Snippet2":::
1021310213

1021410214
The following example is similar to the first, except that it passes the string array to the <xref:System.Array.TrueForAll%2A> method along with a lambda expression that determines whether a particular array element ends with the string representation of a number.
1021510215

10216-
[!code-csharp[System.Array.TrueForAll#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.array.trueforall/cs/trueforall1.cs#1)]
10217-
[!code-vb[System.Array.TrueForAll#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.array.trueforall/vb/trueforall1.vb#1)]
10216+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.array.trueforall/cs/trueforall1.cs" interactive="try-dotnet" id="Snippet1":::
10217+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.array.trueforall/vb/trueforall1.vb" id="Snippet1":::
1021810218

1021910219
In both cases, the <xref:System.Array.TrueForAll%2A> method returns `false` as soon as it encounters the first array element that does not end in a number. Otherwise, it returns `true` after iterating all the elements in the array.
1022010220

xml/System/BitConverter.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,10 +1020,10 @@
10201020
## Examples
10211021
The following code example illustrates the use of the `IsLittleEndian` field.
10221022
1023-
[!code-cpp[System.BitConverter.Class#2](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.Class/CPP/littleend.cpp#2)]
1024-
[!code-csharp[System.BitConverter.Class#2](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.BitConverter.Class/CS/littleend.cs#2)]
1025-
[!code-vb[System.BitConverter.Class#2](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.BitConverter.Class/VB/littleend.vb#2)]
1026-
1023+
:::code language="cpp" source="~/samples/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.Class/CPP/littleend.cpp" id="Snippet2":::
1024+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.BitConverter.Class/CS/littleend.cs" interactive="try-dotnet" id="Snippet2":::
1025+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.BitConverter.Class/VB/littleend.vb" id="Snippet2":::
1026+
10271027
]]></format>
10281028
</remarks>
10291029
</Docs>

xml/System/TimeSpan.xml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3196,9 +3196,9 @@ When a time interval component in the string to be parsed contains more than sev
31963196
## Examples
31973197
The following example uses the <xref:System.TimeSpan.ParseExact%28System.String%2CSystem.String%2CSystem.IFormatProvider%29> method to parse several string representations of time intervals using various format strings and cultures.
31983198
3199-
[!code-csharp[System.TimeSpan.ParseExact#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.timespan.parseexact/cs/parseexactexample1.cs#1)]
3200-
[!code-vb[System.TimeSpan.ParseExact#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.timespan.parseexact/vb/parseexactexample1.vb#1)]
3201-
3199+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.timespan.parseexact/cs/parseexactexample1.cs" interactive="try-dotnet" id="Snippet1":::
3200+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.timespan.parseexact/vb/parseexactexample1.vb" id="Snippet1":::
3201+
32023202
]]></format>
32033203
</remarks>
32043204
<exception cref="T:System.ArgumentNullException">
@@ -3287,9 +3287,9 @@ When a time interval component in the string to be parsed contains more than sev
32873287
32883288
In addition, the example changes the way in which the time interval parsing methods interpret a single digit. Ordinarily, a single digit is interpreted as the number of days in a time interval. Instead, the `%h` custom format string is used to interpret a single digit as the number of hours. For this change to be effective, note that the `%h` custom format string must precede the other format strings in the `formats` array.
32893289
3290-
[!code-csharp[System.TimeSpan.ParseExact#3](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.timespan.parseexact/cs/parseexactexample3.cs#3)]
3291-
[!code-vb[System.TimeSpan.ParseExact#3](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.timespan.parseexact/vb/parseexactexample3.vb#3)]
3292-
3290+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.timespan.parseexact/cs/parseexactexample3.cs" interactive="try-dotnet" id="Snippet3":::
3291+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.timespan.parseexact/vb/parseexactexample3.vb" id="Snippet3":::
3292+
32933293
]]></format>
32943294
</remarks>
32953295
<exception cref="T:System.ArgumentNullException">
@@ -3461,9 +3461,9 @@ When a time interval component in the string to be parsed contains more than sev
34613461
## Examples
34623462
The following example uses the <xref:System.TimeSpan.ParseExact%28System.String%2CSystem.String%2CSystem.IFormatProvider%29> method to parse several string representations of time intervals using various format strings and cultures. It also uses the <xref:System.Globalization.TimeSpanStyles.AssumeNegative?displayProperty=nameWithType> value to interpret each string as a negative time interval. The output from the example illustrates that the <xref:System.Globalization.TimeSpanStyles.AssumeNegative?displayProperty=nameWithType> style affects the return value only when it is used with custom format strings.
34633463
3464-
[!code-csharp[System.TimeSpan.ParseExact#2](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.timespan.parseexact/cs/parseexactexample2.cs#2)]
3465-
[!code-vb[System.TimeSpan.ParseExact#2](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.timespan.parseexact/vb/parseexactexample2.vb#2)]
3466-
3464+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.timespan.parseexact/cs/parseexactexample2.cs" interactive="try-dotnet" id="Snippet2":::
3465+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.timespan.parseexact/vb/parseexactexample2.vb" id="Snippet2":::
3466+
34673467
]]></format>
34683468
</remarks>
34693469
<exception cref="T:System.ArgumentException">

0 commit comments

Comments
 (0)