Skip to content

Commit 8e6a316

Browse files
authored
enable_try_dotnet_to_batch_12b (#4404)
1 parent 9b62201 commit 8e6a316

File tree

5 files changed

+33
-33
lines changed

5 files changed

+33
-33
lines changed

xml/System/Array.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2787,18 +2787,18 @@
27872787
## Examples
27882788
The following example specifies the match conditions for the <xref:System.Array.Exists%2A> method using lambda expressions to check whether a planet starts with a given letter or whether the planet is found on the given array.
27892789

2790-
[!code-csharp[System.Array.Exists#3](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.array.exists/cs/exists3.cs#3)]
2791-
[!code-vb[System.Array.Exists#3](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.array.exists/vb/exists3.vb#3)]
2790+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.array.exists/cs/exists3.cs" interactive="try-dotnet" id="Snippet3":::
2791+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.array.exists/vb/exists3.vb" id="Snippet3":::
27922792

27932793
The following example uses the <xref:System.Array.Exists%2A> method to indicate whether any names in a string array begin with a specified character. The example instantiates a `StringSearcher` object by passing the string to search for to its class constructor. The `StringSearcher.StartsWith` method has same signature as the <xref:System.Predicate%601> delegate. When the <xref:System.Array.Exists%2A> method is called, each member of the array is passed to the delegate until it returns `true` or iterates all the elements in the array.
27942794

2795-
[!code-csharp[System.Array.Exists#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.array.exists/cs/exists1.cs#1)]
2796-
[!code-vb[System.Array.Exists#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.array.exists/vb/exists1.vb#1)]
2795+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.array.exists/cs/exists1.cs" interactive="try-dotnet" id="Snippet1":::
2796+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.array.exists/vb/exists1.vb" id="Snippet1":::
27972797

27982798
You can also use a lambda expression rather than explicitly define a method whose signature corresponds to that of the delegate. The following example replaces the `StringSearcher` class and its `StartsWith` method with a lambda expression.
27992799

2800-
[!code-csharp[System.Array.Exists#2](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.array.exists/cs/exists2.cs#2)]
2801-
[!code-vb[System.Array.Exists#2](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.array.exists/vb/exists2.vb#2)]
2800+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.array.exists/cs/exists2.cs" interactive="try-dotnet" id="Snippet2":::
2801+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.array.exists/vb/exists2.vb" id="Snippet2":::
28022802

28032803
]]></format>
28042804
</remarks>

xml/System/BitConverter.xml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@
6666
6767
If you use <xref:System.BitConverter> methods to round-trip data, make sure that the <xref:System.BitConverter.GetBytes%2A> overload and the `To`*Type* method specify the same type. As the following example illustrates, restoring an array that represents a signed integer by calling the <xref:System.BitConverter.ToUInt32%2A> method can result in a value that is different from the original. For more information, see the entry [Working with Signed Non-Decimal and Bitwise Values](https://go.microsoft.com/fwlink/?LinkId=186999) in the BCL Team Blog.
6868
69-
[!code-csharp[System.BitConverter.Class#3](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.BitConverter.Class/CS/example1.cs#3)]
70-
[!code-vb[System.BitConverter.Class#3](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.BitConverter.Class/VB/example1.vb#3)]
69+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.BitConverter.Class/CS/example1.cs" interactive="try-dotnet" id="Snippet3":::
70+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.BitConverter.Class/VB/example1.vb" id="Snippet3":::
7171
7272
The order of bytes in the array returned by the <xref:System.BitConverter.GetBytes%2A> method overloads (as well as the order of bits in the integer returned by the <xref:System.BitConverter.DoubleToInt64Bits%2A> method and the order of hexadecimal strings returned by the <xref:System.BitConverter.ToString%28System.Byte%5B%5D%29> method) depends on whether the computer architecture is little-endian or big-endian. Similarly, the order of bytes in the array and returned by the `To`*IntegerValue* methods and the <xref:System.BitConverter.ToChar%2A> method depends on whether the computer architecture is little-endian or big-endian. The endianness of an architecture is indicated by the <xref:System.BitConverter.IsLittleEndian> property, which returns `true` on little-endian systems and `false` on big-endian systems. On little-endian systems, lower-order bytes precede higher-order bytes. On big-endian system, higher-order bytes precede lower-order bytes. The following table illustrates the difference in the byte arrays that result from passing the integer 1,234,567,890 (0x499602D2) to the <xref:System.BitConverter.GetBytes%28System.Int32%29> method. The bytes are listed in order from the byte at index 0 to the byte at index 3.
7373
@@ -82,8 +82,8 @@
8282
8383
- If systems sending and receiving data can have different endianness, always transmit data in a particular order. This means that the order of bytes in the array may have to be reversed either before sending them or after receiving them. A common convention is to transmit data in network byte order (big-endian order). The following example provides an implementation for sending an integer value in network byte order.
8484
85-
[!code-csharp[System.BitConverter.Class#4](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.BitConverter.Class/CS/networkorder1.cs#4)]
86-
[!code-vb[System.BitConverter.Class#4](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.BitConverter.Class/VB/networkorder1.vb#4)]
85+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.BitConverter.Class/CS/networkorder1.cs" interactive="try-dotnet" id="Snippet4":::
86+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.BitConverter.Class/VB/networkorder1.vb" id="Snippet4":::
8787
8888
- If systems sending and receiving data can have different endianness and the data to be transmitted consists of signed integers, call the <xref:System.Net.IPAddress.HostToNetworkOrder%2A?displayProperty=nameWithType> method to convert the data to network byte order and the <xref:System.Net.IPAddress.NetworkToHostOrder%2A?displayProperty=nameWithType> method to convert it to the order required by the recipient.
8989
@@ -92,9 +92,9 @@
9292
## Examples
9393
The following code example illustrates the use of several <xref:System.BitConverter> class methods.
9494
95-
[!code-cpp[System.BitConverter.Class#1](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.Class/CPP/bitconv.cpp#1)]
96-
[!code-csharp[System.BitConverter.Class#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.BitConverter.Class/CS/bitconv.cs#1)]
97-
[!code-vb[System.BitConverter.Class#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.BitConverter.Class/VB/bitconv.vb#1)]
95+
:::code language="cpp" source="~/samples/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.Class/CPP/bitconv.cpp" id="Snippet1":::
96+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.BitConverter.Class/CS/bitconv.cs" interactive="try-dotnet" id="Snippet1":::
97+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.BitConverter.Class/VB/bitconv.vb" id="Snippet1":::
9898
9999
]]></format>
100100
</remarks>

xml/System/Byte.xml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -92,18 +92,18 @@
9292
9393
- You can assign a non-byte numeric value to a byte. This is a narrowing conversion, so it requires a cast operator in C# and a conversion method in Visual Basic if `Option Strict` is on. If the non-byte value is a <xref:System.Single>, <xref:System.Double>, or <xref:System.Decimal> value that includes a fractional component, the handling of its fractional part depends on the compiler performing the conversion. The following example assigns several numeric values to <xref:System.Byte> variables.
9494
95-
[!code-csharp[System.Byte.Instantiation#2](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.byte.instantiation/cs/byteinstantiation1.cs#2)]
96-
[!code-vb[System.Byte.Instantiation#2](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.byte.instantiation/vb/byteinstantiate1.vb#2)]
95+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.byte.instantiation/cs/byteinstantiation1.cs" interactive="try-dotnet-method" id="Snippet2":::
96+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.byte.instantiation/vb/byteinstantiate1.vb" id="Snippet2":::
9797
9898
- You can call a method of the <xref:System.Convert> class to convert any supported type to a <xref:System.Byte> value. This is possible because <xref:System.Byte> supports the <xref:System.IConvertible> interface. The following example illustrates the conversion of an array of <xref:System.Int32> values to <xref:System.Byte> values.
9999
100-
[!code-csharp[System.Convert.ToByte#4](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.convert.tobyte/cs/tobyte1.cs#4)]
101-
[!code-vb[System.Convert.ToByte#4](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.convert.tobyte/vb/tobyte1.vb#4)]
100+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.convert.tobyte/cs/tobyte1.cs" interactive="try-dotnet-method" id="Snippet4":::
101+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.convert.tobyte/vb/tobyte1.vb" id="Snippet4":::
102102
103103
- You can call the <xref:System.Byte.Parse%2A> or <xref:System.Byte.TryParse%2A> method to convert the string representation of a <xref:System.Byte> value to a <xref:System.Byte>. The string can contain either decimal or hexadecimal digits. The following example illustrates the parse operation by using both a decimal and a hexadecimal string.
104104
105-
[!code-csharp[System.Byte.Instantiation#3](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.byte.instantiation/cs/byteinstantiation1.cs#3)]
106-
[!code-vb[System.Byte.Instantiation#3](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.byte.instantiation/vb/byteinstantiate1.vb#3)]
105+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.byte.instantiation/cs/byteinstantiation1.cs" interactive="try-dotnet-method" id="Snippet3":::
106+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.byte.instantiation/vb/byteinstantiate1.vb" id="Snippet3":::
107107
108108
## Performing Operations on Byte Values
109109
The <xref:System.Byte> type supports standard mathematical operations such as addition, subtraction, division, multiplication, subtraction, negation, and unary negation. Like the other integral types, the <xref:System.Byte> type also supports the bitwise `AND`, `OR`, `XOR`, left shift, and right shift operators.
@@ -117,13 +117,13 @@
117117
118118
To format a <xref:System.Byte> value as an integral string with no leading zeros, you can call the parameterless <xref:System.Byte.ToString> method. By using the "D" format specifier, you can also include a specified number of leading zeros in the string representation. By using the "X" format specifier, you can represent a <xref:System.Byte> value as a hexadecimal string. The following example formats the elements in an array of <xref:System.Byte> values in these three ways.
119119
120-
[!code-csharp[System.Byte.Formatting#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.byte.formatting/cs/formatting1.cs#1)]
121-
[!code-vb[System.Byte.Formatting#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.byte.formatting/vb/formatting1.vb#1)]
120+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.byte.formatting/cs/formatting1.cs" interactive="try-dotnet-method" id="Snippet1":::
121+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.byte.formatting/vb/formatting1.vb" id="Snippet1":::
122122
123123
You can also format a <xref:System.Byte> value as a binary, octal, decimal, or hexadecimal string by calling the <xref:System.Convert.ToString%28System.Byte%2CSystem.Int32%29> method and supplying the base as the method's second parameter. The following example calls this method to display the binary, octal, and hexadecimal representations of an array of byte values.
124124
125-
[!code-csharp[System.Byte.Formatting#2](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.byte.formatting/cs/formatting1.cs#2)]
126-
[!code-vb[System.Byte.Formatting#2](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.byte.formatting/vb/formatting1.vb#2)]
125+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.byte.formatting/cs/formatting1.cs" interactive="try-dotnet-method" id="Snippet2":::
126+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.byte.formatting/vb/formatting1.vb" id="Snippet2":::
127127
128128
## Working with Non-Decimal Byte Values
129129
In addition to working with individual bytes as decimal values, you may want to perform bitwise operations with byte values, or work with byte arrays or with the binary or hexadecimal representations of byte values. For example, overloads of the <xref:System.BitConverter.GetBytes%2A?displayProperty=nameWithType> method can convert each of the primitive data types to a byte array, and the <xref:System.Numerics.BigInteger.ToByteArray%2A?displayProperty=nameWithType> method converts a <xref:System.Numerics.BigInteger> value to a byte array.
@@ -132,13 +132,13 @@
132132
133133
When an operation is performed on two <xref:System.Byte> values, the values share the same representation, so the result is accurate. This is illustrated in the following example, which masks the lowest-order bit of a <xref:System.Byte> value to ensure that it is even.
134134
135-
[!code-csharp[System.Byte.Bitwise#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.byte.bitwise/cs/bitwise1.cs#1)]
136-
[!code-vb[System.Byte.Bitwise#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.byte.bitwise/vb/bitwise1.vb#1)]
135+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.byte.bitwise/cs/bitwise1.cs" interactive="try-dotnet" id="Snippet1":::
136+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.byte.bitwise/vb/bitwise1.vb" id="Snippet1":::
137137
138138
On the other hand, when you work with both unsigned and signed bits, bitwise operations are complicated by the fact that the <xref:System.SByte> values use sign-and-magnitude representation for positive values, and two's complement representation for negative values. In order to perform a meaningful bitwise operation, the values must be converted to two equivalent representations, and information about the sign bit must be preserved. The following example does this to mask out bits 2 and 4 of an array of 8-bit signed and unsigned values.
139139
140-
[!code-csharp[System.Byte.Bitwise#2](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.byte.bitwise/cs/bitwise2.cs#2)]
141-
[!code-vb[System.Byte.Bitwise#2](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.byte.bitwise/vb/bitwise2.vb#2)]
140+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.byte.bitwise/cs/bitwise2.cs" interactive="try-dotnet" id="Snippet2":::
141+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.byte.bitwise/vb/bitwise2.vb" id="Snippet2":::
142142
143143
]]></format>
144144
</remarks>

xml/System/DayOfWeek.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@
5959
## Examples
6060
The following example demonstrates the <xref:System.DateTime.DayOfWeek%2A?displayProperty=nameWithType> property and the <xref:System.DayOfWeek> enumeration.
6161
62-
[!code-cpp[DateTime.DayOfWeek#1](~/samples/snippets/cpp/VS_Snippets_CLR/DateTime.DayOfWeek/CPP/dow.cpp#1)]
63-
[!code-csharp[DateTime.DayOfWeek#1](~/samples/snippets/csharp/VS_Snippets_CLR/DateTime.DayOfWeek/CS/dow.cs#1)]
64-
[!code-vb[DateTime.DayOfWeek#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/DateTime.DayOfWeek/VB/dow.vb#1)]
62+
:::code language="cpp" source="~/samples/snippets/cpp/VS_Snippets_CLR/DateTime.DayOfWeek/CPP/dow.cpp" id="Snippet1":::
63+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR/DateTime.DayOfWeek/CS/dow.cs" interactive="try-dotnet" id="Snippet1":::
64+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR/DateTime.DayOfWeek/VB/dow.vb" id="Snippet1":::
6565
6666
]]></format>
6767
</remarks>

xml/System/Environment.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2400,9 +2400,9 @@ The following example creates environment variables for the <xref:System.Environ
24002400
## Examples
24012401
The following example displays the user name of the person who started the current thread.
24022402
2403-
[!code-cpp[Environment.UserName#1](~/samples/snippets/cpp/VS_Snippets_CLR/Environment.UserName/CPP/username.cpp#1)]
2404-
[!code-csharp[Environment.UserName#1](~/samples/snippets/csharp/VS_Snippets_CLR/Environment.UserName/CS/username.cs#1)]
2405-
[!code-vb[Environment.UserName#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/Environment.UserName/VB/username.vb#1)]
2403+
:::code language="cpp" source="~/samples/snippets/cpp/VS_Snippets_CLR/Environment.UserName/CPP/username.cpp" id="Snippet1":::
2404+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR/Environment.UserName/CS/username.cs" interactive="try-dotnet" id="Snippet1":::
2405+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR/Environment.UserName/VB/username.vb" id="Snippet1":::
24062406
24072407
]]></format>
24082408
</remarks>

0 commit comments

Comments
 (0)