Skip to content

Commit 308e106

Browse files
v-mepamairaw
andauthored
.NET Interactive: Add try dotnet to batch 19b (#4709)
* enable_try_dotnet_to_batch_19b * line_spacing * change sample applied * change try.net mode Co-authored-by: Maira Wenzel <[email protected]>
1 parent 3e68fa0 commit 308e106

File tree

7 files changed

+55
-55
lines changed

7 files changed

+55
-55
lines changed

xml/System.Globalization/NumberFormatInfo.xml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -595,10 +595,10 @@
595595
## Examples
596596
The following example demonstrates the effect of changing the <xref:System.Globalization.NumberFormatInfo.CurrencyDecimalSeparator%2A> property.
597597
598-
[!code-cpp[CurrencyDecimalSeparator#1](~/samples/snippets/cpp/VS_Snippets_CLR/CurrencyDecimalSeparator/CPP/currencydecimalseparator.cpp#1)]
599-
[!code-csharp[CurrencyDecimalSeparator#1](~/samples/snippets/csharp/VS_Snippets_CLR/CurrencyDecimalSeparator/CS/currencydecimalseparator.cs#1)]
600-
[!code-vb[CurrencyDecimalSeparator#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/CurrencyDecimalSeparator/VB/currencydecimalseparator.vb#1)]
601-
598+
:::code language="cpp" source="~/samples/snippets/cpp/VS_Snippets_CLR/CurrencyDecimalSeparator/CPP/currencydecimalseparator.cpp" id="Snippet1":::
599+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR/CurrencyDecimalSeparator/CS/currencydecimalseparator.cs" interactive="try-dotnet" id="Snippet1":::
600+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR/CurrencyDecimalSeparator/VB/currencydecimalseparator.vb" id="Snippet1":::
601+
602602
]]></format>
603603
</remarks>
604604
<exception cref="T:System.ArgumentNullException">The property is being set to <see langword="null" />.</exception>
@@ -1992,11 +1992,11 @@
19921992
19931993
## Examples
19941994
The following example demonstrates the effect of changing the <xref:System.Globalization.NumberFormatInfo.PercentDecimalDigits%2A> property.
1995-
1996-
[!code-cpp[PercentDecimalDigits#1](~/samples/snippets/cpp/VS_Snippets_CLR/PercentDecimalDigits/CPP/percentdecimaldigits.cpp#1)]
1997-
[!code-csharp[PercentDecimalDigits#1](~/samples/snippets/csharp/VS_Snippets_CLR/PercentDecimalDigits/CS/percentdecimaldigits.cs#1)]
1998-
[!code-vb[PercentDecimalDigits#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/PercentDecimalDigits/VB/percentdecimaldigits.vb#1)]
1999-
1995+
1996+
:::code language="cpp" source="~/samples/snippets/cpp/VS_Snippets_CLR/PercentDecimalDigits/CPP/percentdecimaldigits.cpp" id="Snippet1":::
1997+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR/PercentDecimalDigits/CS/percentdecimaldigits.cs" interactive="try-dotnet" id="Snippet1":::
1998+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR/PercentDecimalDigits/VB/percentdecimaldigits.vb" id="Snippet1":::
1999+
20002000
]]></format>
20012001
</remarks>
20022002
<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.Security.Cryptography/HashAlgorithm.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,8 @@
299299
## Examples
300300
The following example computes the <xref:System.Security.Cryptography.SHA256> hash value of a string and returns the hash as a 64-character, hexadecimal-formatted string. The hash string created by this code example is compatible with any SHA256 hash function (on any platform) that creates a 64-character, hexadecimal-formatted hash string.
301301
302-
[!code-csharp[HashAlgorithm.ComputeHash-1](~/samples/snippets/csharp/api/system.security.cryptography/hashalgorithm/example1.cs)]
303-
[!code-vb[HashAlgorithm.ComputeHash-1](~/samples/snippets/visualbasic/api/system.security.cryptography/hashalgorithm/example1.vb)]
302+
:::code language="csharp" source="~/samples/snippets/csharp/api/system.security.cryptography/hashalgorithm/example1.cs" interactive="try-dotnet":::
303+
:::code language="vb" source="~/samples/snippets/visualbasic/api/system.security.cryptography/hashalgorithm/example1.vb":::
304304
305305
]]></format>
306306
</remarks>
@@ -353,9 +353,9 @@
353353
## Examples
354354
355355
The following example calculates the <xref:System.Security.Cryptography.SHA256> hash for all files in a directory.
356-
357-
[!code-csharp[HashAlgorithm.ComputeHash Example](~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic SHA256 Example/CS/source.cs#1)]
358-
[!code-vb[HashAlgorithm.ComputeHash Example](~/samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic SHA256 Example/VB/source.vb#1)]
356+
357+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic SHA256 Example/CS/source.cs" id="Snippet1":::
358+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic SHA256 Example/VB/source.vb" id="Snippet1":::
359359
360360
]]></format>
361361
</remarks>

xml/System.Security.Cryptography/RijndaelManaged.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@
5555
## Examples
5656
The following example demonstrates how to encrypt and decrypt sample data using the `RijndaelManaged` class.
5757
58-
[!code-cpp[RijndaelManaged Example#1](~/samples/snippets/cpp/VS_Snippets_CLR/RijndaelManaged Example/CPP/class1.cpp#1)]
59-
[!code-csharp[RijndaelManaged Example#1](~/samples/snippets/csharp/VS_Snippets_CLR/RijndaelManaged Example/CS/class1.cs#1)]
60-
[!code-vb[RijndaelManaged Example#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/RijndaelManaged Example/VB/class1.vb#1)]
61-
58+
:::code language="cpp" source="~/samples/snippets/cpp/VS_Snippets_CLR/RijndaelManaged Example/CPP/class1.cpp" id="Snippet1":::
59+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR/RijndaelManaged Example/CS/class1.cs" interactive="try-dotnet" id="Snippet1":::
60+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR/RijndaelManaged Example/VB/class1.vb" id="Snippet1":::
61+
6262
]]></format>
6363
</remarks>
6464
<related type="Article" href="/dotnet/standard/security/cryptographic-services">Cryptographic Services</related>

xml/System/Convert.xml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -295,13 +295,13 @@
295295
<block subset="none" type="usage">
296296
<para>The <see cref="M:System.Convert.ChangeType(System.Object,System.Type)" /> method can convert an enumeration value to another type. However, it cannot convert another type to an enumeration value, even if the source type is the underlying type of the enumeration. To convert a type to an enumeration value, use a casting operator (in C#) or a conversion function (in Visual Basic). The following example illustrates the conversion to and from a <c>Continent</c> enumeration value.
297297

298-
[!code-csharp[System.Convert.ChangeType#5](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.convert.changetype/cs/changetype_enum2.cs#5)]
299-
[!code-vb[System.Convert.ChangeType#5](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.convert.changetype/vb/changetype_enum2.vb#5)]
300-
298+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.convert.changetype/cs/changetype_enum2.cs" interactive="try-dotnet" id="Snippet5":::
299+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.convert.changetype/vb/changetype_enum2.vb" id="Snippet5":::
300+
301301
The <see cref="M:System.Convert.ChangeType(System.Object,System.Type)" /> method can convert a nullable type to another type. However, it cannot convert another type to a value of a nullable type, even if <paramref name="conversionType" /> is the underlying type of the <see cref="T:System.Nullable`1" />.To perform the conversion, you can use a casting operator (in C#) or a conversion function (in Visual Basic). The following example illustrates the conversion to and from a nullable type.
302-
303-
[!code-csharp[System.Convert.ChangeType#7](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.convert.changetype/cs/changetype_nullable.cs#7)]
304-
[!code-vb[System.Convert.ChangeType#7](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.convert.changetype/vb/changetype_nullable.vb#7)]</para>
302+
303+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.convert.changetype/cs/changetype_nullable.cs" interactive="try-dotnet" id="Snippet7":::
304+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.convert.changetype/vb/changetype_nullable.vb" id="Snippet7"::: </para>
305305
</block>
306306
</Docs>
307307
</Member>
@@ -497,14 +497,14 @@
497497
<paramref name="conversionType" /> is <see langword="null" />.</exception>
498498
<block subset="none" type="usage">
499499
<para>The <see cref="M:System.Convert.ChangeType(System.Object,System.Type,System.IFormatProvider)" /> method can convert an enumeration value to another type. However, it cannot convert another type to an enumeration value, even if the source type is the underlying type of the enumeration. To convert a type to an enumeration value, use a casting operator (in C#) or a conversion function (in Visual Basic). The following example illustrates the conversion to and from a <c>Continent</c> enumeration value.
500-
501-
[!code-csharp[System.Convert.ChangeType#5](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.convert.changetype/cs/changetype_enum2.cs#5)]
502-
[!code-vb[System.Convert.ChangeType#5](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.convert.changetype/vb/changetype_enum2.vb#5)]
500+
501+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.convert.changetype/cs/changetype_enum2.cs" interactive="try-dotnet" id="Snippet5":::
502+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.convert.changetype/vb/changetype_enum2.vb" id="Snippet5":::
503503

504504
The <see cref="M:System.Convert.ChangeType(System.Object,System.Type,System.IFormatProvider)" /> method can convert a nullable type to another type. However, it cannot convert another type to a value of a nullable type, even if <paramref name="conversionType" /> is the underlying type of the <see cref="T:System.Nullable`1" />. To perform the conversion, you can use a casting operator (in C#) or a conversion function (in Visual Basic). The following example illustrates the conversion to and from a nullable type.
505-
506-
[!code-csharp[System.Convert.ChangeType#8](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.convert.changetype/cs/changetype_nullable_1.cs#8)]
507-
[!code-vb[System.Convert.ChangeType#8](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.convert.changetype/vb/changetype_nullable_1.vb#8)]</para>
505+
506+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.convert.changetype/cs/changetype_nullable_1.cs" interactive="try-dotnet" id="Snippet8":::
507+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.convert.changetype/vb/changetype_nullable_1.vb" id="Snippet8":::</para>
508508
</block>
509509
</Docs>
510510
</Member>

xml/System/Exception.xml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -895,11 +895,11 @@ Stack Trace:
895895
896896
## Examples
897897
The following code example throws an `Exception` that sets the `HelpLink` property in its constructor and then catches the exception and displays `HelpLink`.
898-
899-
[!code-cpp[System.Exception.Properties#1](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Properties/CPP/properties.cpp#1)]
900-
[!code-csharp[System.Exception.Properties#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Exception.Properties/CS/properties.cs#1)]
901-
[!code-vb[System.Exception.Properties#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Exception.Properties/VB/properties.vb#1)]
902-
898+
899+
:::code language="cpp" source="~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Properties/CPP/properties.cpp" id="Snippet1":::
900+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Exception.Properties/CS/properties.cs" interactive="try-dotnet" id="Snippet1":::
901+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Exception.Properties/VB/properties.vb" id="Snippet1":::
902+
903903
]]></format>
904904
</remarks>
905905
</Docs>
@@ -1237,10 +1237,10 @@ Stack Trace:
12371237
## Examples
12381238
The following example throws an `Exception` that sets the `Source` property in its constructor and then catches the exception and displays `Source`.
12391239
1240-
[!code-cpp[System.Exception.Properties#1](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Properties/CPP/properties.cpp#1)]
1241-
[!code-csharp[System.Exception.Properties#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Exception.Properties/CS/properties.cs#1)]
1242-
[!code-vb[System.Exception.Properties#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Exception.Properties/VB/properties.vb#1)]
1243-
1240+
:::code language="cpp" source="~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Properties/CPP/properties.cpp" id="Snippet1":::
1241+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Exception.Properties/CS/properties.cs" interactive="try-dotnet" id="Snippet1":::
1242+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Exception.Properties/VB/properties.vb" id="Snippet1":::
1243+
12441244
]]></format>
12451245
</remarks>
12461246
<exception cref="T:System.ArgumentException">The object must be a runtime <see cref="N:System.Reflection" /> object.</exception>
@@ -1378,11 +1378,11 @@ Stack Trace:
13781378
13791379
## Examples
13801380
The following code example throws an `Exception` and then catches it and displays the originating method using the `TargetSite` property.
1381-
1382-
[!code-cpp[System.Exception.Properties#1](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Properties/CPP/properties.cpp#1)]
1383-
[!code-csharp[System.Exception.Properties#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Exception.Properties/CS/properties.cs#1)]
1384-
[!code-vb[System.Exception.Properties#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Exception.Properties/VB/properties.vb#1)]
1385-
1381+
1382+
:::code language="cpp" source="~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Properties/CPP/properties.cpp" id="Snippet1":::
1383+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Exception.Properties/CS/properties.cs" interactive="try-dotnet" id="Snippet1":::
1384+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Exception.Properties/VB/properties.vb" id="Snippet1":::
1385+
13861386
]]></format>
13871387
</remarks>
13881388
</Docs>

xml/System/IComparable.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,10 @@
146146
## Examples
147147
The following example illustrates the use of <xref:System.IComparable.CompareTo%2A> to compare a `Temperature` object implementing <xref:System.IComparable> with another object. The `Temperature` object implements <xref:System.IComparable.CompareTo%2A> by simply wrapping a call to the <xref:System.Int32.CompareTo%2A?displayProperty=nameWithType> method.
148148
149-
[!code-cpp[IComparable Example#1](~/samples/snippets/cpp/VS_Snippets_CLR/IComparable Example/CPP/source.cpp#1)]
150-
[!code-csharp[IComparable Example#1](~/samples/snippets/csharp/VS_Snippets_CLR/IComparable Example/CS/source.cs#1)]
151-
[!code-vb[IComparable Example#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/IComparable Example/VB/source.vb#1)]
152-
149+
:::code language="cpp" source="~/samples/snippets/cpp/VS_Snippets_CLR/IComparable Example/CPP/source.cpp" id="Snippet1":::
150+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR/IComparable Example/CS/source.cs" interactive="try-dotnet" id="Snippet1":::
151+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR/IComparable Example/VB/source.vb" id="Snippet1":::
152+
153153
]]></format>
154154
</remarks>
155155
<exception cref="T:System.ArgumentException">

xml/System/Version.xml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -140,16 +140,16 @@
140140
## Comparing Version Objects
141141
You can use the <xref:System.Version.CompareTo%2A> method to determine whether one <xref:System.Version> object is earlier than, the same as, or later than a second <xref:System.Version> object. The following example indicates that Version 2.1 is later than Version 2.0.
142142
143-
[!code-csharp[System.Version.Class.Comparing#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.version.class.comparing/cs/comparisons1.cs#1)]
144-
[!code-vb[System.Version.Class.Comparing#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.version.class.comparing/vb/comparisons1.vb#1)]
145-
143+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.version.class.comparing/cs/comparisons1.cs" interactive="try-dotnet-method" id="Snippet1":::
144+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.version.class.comparing/vb/comparisons1.vb" id="Snippet1":::
145+
146146
For two versions to be equal, the major, minor, build, and revision numbers of the first <xref:System.Version> object must be identical to those of the second <xref:System.Version> object. If the build or revision number of a <xref:System.Version> object is undefined, that <xref:System.Version> object is considered to be earlier than a <xref:System.Version> object whose build or revision number is equal to zero. The following example illustrates this by comparing three <xref:System.Version> objects that have undefined version components.
147-
148-
[!code-csharp[System.Version.Class.Comparing#2](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.version.class.comparing/cs/comparisons2.cs#2)]
149-
[!code-vb[System.Version.Class.Comparing#2](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.version.class.comparing/vb/comparisons2.vb#2)]
150-
147+
148+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.version.class.comparing/cs/comparisons2.cs" interactive="try-dotnet" id="Snippet2":::
149+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.version.class.comparing/vb/comparisons2.vb" id="Snippet2":::
151150
152151
152+
153153
## Examples
154154
The following example uses the <xref:System.Reflection.AssemblyVersionAttribute> attribute to assign a version number to an assembly. At compile time, this version information is stored with the assembly's metadata. At run time, the example retrieves the value of the <xref:System.Type.Assembly%2A?displayProperty=nameWithType> property on a type found in the assembly to get a reference to the executing assembly, and it retrieves the assembly's version information from the <xref:System.Reflection.AssemblyName.Version%2A> property of the <xref:System.Reflection.AssemblyName> object returned by the <xref:System.Reflection.Assembly.GetName%2A?displayProperty=nameWithType> method.
155155

0 commit comments

Comments
 (0)