Skip to content

Commit 9b62201

Browse files
authored
Enable_try_dotnet_to_batch_12a (#4395)
1 parent b002899 commit 9b62201

File tree

5 files changed

+33
-33
lines changed

5 files changed

+33
-33
lines changed

xml/System.Globalization/CultureInfo.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2744,8 +2744,8 @@ For a list of predefined culture names on Windows systems, see the **Language ta
27442744
27452745
The following example uses the invariant culture to persist a <xref:System.DateTime> value as a string. It then parses the string and displays its value by using the formatting conventions of the French (France) and German (Germany) cultures.
27462746
2747-
[!code-csharp[System.Globalization.CultureInfo.InvariantCulture#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.globalization.cultureinfo.invariantculture/cs/persist1.cs#1)]
2748-
[!code-vb[System.Globalization.CultureInfo.InvariantCulture#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.globalization.cultureinfo.invariantculture/vb/persist1.vb#1)]
2747+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.globalization.cultureinfo.invariantculture/cs/persist1.cs" interactive="try-dotnet" id="Snippet1":::
2748+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.globalization.cultureinfo.invariantculture/vb/persist1.vb" id="Snippet1":::
27492749
27502750
## Security Decisions
27512751
If you are making a security decision (such as whether to allow access to a system resource) based on the result of a string comparison or a case change, you should not use the invariant culture. Instead, you should perform a case-sensitive or case-insensitive ordinal comparison by calling a method that includes a <xref:System.StringComparison> parameter and supplying either <xref:System.StringComparison.Ordinal?displayProperty=nameWithType> or <xref:System.StringComparison.OrdinalIgnoreCase?displayProperty=nameWithType> as an argument. Code that performs culture-sensitive string operations can cause security vulnerabilities if the current culture is changed or if the culture on the computer that is running the code differs from the culture that is used to test the code. In contrast, an ordinal comparison depends solely on the binary value of the compared characters.

xml/System.Text/Encoding.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5397,8 +5397,8 @@ Starting with the .NET Framework 4.6, the .NET Framework includes one encoding p
53975397
53985398
- It returns a <xref:System.Text.UTF8Encoding> object that uses replacement fallback to replace each string that it can't encode and each byte that it can't decode with a question mark ("?") character. Instead, you can call the <xref:System.Text.UTF8Encoding.%23ctor%28System.Boolean%2CSystem.Boolean%29?displayProperty=nameWithType> constructor to instantiate a <xref:System.Text.UTF8Encoding> object whose fallback is either an <xref:System.Text.EncoderFallbackException> or a <xref:System.Text.DecoderFallbackException>, as the following example illustrates.
53995399
5400-
[!code-csharp[System.Text.Encoding.UTF8#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.text.encoding.utf8/cs/encoding.utf8.1.cs#1)]
5401-
[!code-vb[System.Text.Encoding.UTF8#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.text.encoding.utf8/vb/encoding.utf8.1.vb#1)]
5400+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.text.encoding.utf8/cs/encoding.utf8.1.cs" interactive="try-dotnet" id="Snippet1":::
5401+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.text.encoding.utf8/vb/encoding.utf8.1.vb" id="Snippet1":::
54025402
54035403
54045404
@@ -5419,8 +5419,8 @@ Starting with the .NET Framework 4.6, the .NET Framework includes one encoding p
54195419
54205420
It displays the UTF-16 code units of each character and determines the number of bytes required by a UTF-8 encoder to encode the character array. It then encodes the characters and displays the resulting UTF-8-encoded bytes.
54215421
5422-
[!code-csharp[System.Text.Encoding.UTF8#2](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.text.encoding.utf8/cs/example1.cs#2)]
5423-
[!code-vb[System.Text.Encoding.UTF8#2](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.text.encoding.utf8/vb/example1.vb#2)]
5422+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.text.encoding.utf8/cs/example1.cs" interactive="try-dotnet" id="Snippet2":::
5423+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.text.encoding.utf8/vb/example1.vb" id="Snippet2":::
54245424
54255425
]]></format>
54265426
</remarks>

xml/System/Environment.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1565,9 +1565,9 @@ The following example creates environment variables for the <xref:System.Environ
15651565
## Examples
15661566
The following example displays three lines separated by newlines.
15671567
1568-
[!code-cpp[environment.newline#1](~/samples/snippets/cpp/VS_Snippets_CLR/Environment.NewLine/CPP/newline.cpp#1)]
1569-
[!code-csharp[environment.newline#1](~/samples/snippets/csharp/VS_Snippets_CLR/Environment.NewLine/CS/newline.cs#1)]
1570-
[!code-vb[environment.newline#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/Environment.NewLine/VB/newline.vb#1)]
1568+
:::code language="cpp" source="~/samples/snippets/cpp/VS_Snippets_CLR/Environment.NewLine/CPP/newline.cpp" id="Snippet1":::
1569+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR/Environment.NewLine/CS/newline.cs" interactive="try-dotnet" id="Snippet1":::
1570+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR/Environment.NewLine/VB/newline.vb" id="Snippet1":::
15711571
15721572
]]></format>
15731573
</remarks>

xml/System/Func`1.xml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,22 +77,22 @@
7777
7878
When you use the <xref:System.Func%601> delegate, you do not have to explicitly define a delegate that encapsulates a parameterless method. For example, the following code explicitly declares a delegate named `WriteMethod` and assigns a reference to the `OutputTarget.SendToFile` instance method to its delegate instance.
7979
80-
[!code-csharp[System.Func~1#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Func~1/cs/Delegate.cs#1)]
81-
[!code-vb[System.Func~1#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Func~1/vb/Delegate.vb#1)]
80+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Func~1/cs/Delegate.cs" interactive="try-dotnet" id="Snippet1":::
81+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Func~1/vb/Delegate.vb" id="Snippet1":::
8282
8383
The following example simplifies this code by instantiating the <xref:System.Func%601> delegate instead of explicitly defining a new delegate and assigning a named method to it.
8484
85-
[!code-csharp[System.Func~1#2](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Func~1/cs/Func1.cs#2)]
86-
[!code-vb[System.Func~1#2](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Func~1/vb/Func1.vb#2)]
85+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Func~1/cs/Func1.cs" interactive="try-dotnet" id="Snippet2":::
86+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Func~1/vb/Func1.vb" id="Snippet2":::
8787
8888
You can use the <xref:System.Func%601> delegate with anonymous methods in C#, as the following example illustrates. (For an introduction to anonymous methods, see [Anonymous Methods](/dotnet/csharp/programming-guide/statements-expressions-operators/anonymous-methods).)
8989
90-
[!code-csharp[System.Func~1#3](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Func~1/cs/Anon.cs#3)]
90+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Func~1/cs/Anon.cs" interactive="try-dotnet" id="Snippet3":::
9191
9292
You can also assign a lambda expression to a <xref:System.Func%602> delegate, as the following example illustrates. (For an introduction to lambda expressions, see [Lambda Expressions](/dotnet/visual-basic/programming-guide/language-features/procedures/lambda-expressions) and [Lambda Expressions](/dotnet/csharp/programming-guide/statements-expressions-operators/lambda-expressions).)
9393
94-
[!code-csharp[System.Func~1#4](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Func~1/cs/Lambda.cs#4)]
95-
[!code-vb[System.Func~1#4](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Func~1/vb/Lambda.vb#4)]
94+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Func~1/cs/Lambda.cs" interactive="try-dotnet" id="Snippet4":::
95+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Func~1/vb/Lambda.vb" id="Snippet4":::
9696
9797
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.
9898
@@ -105,8 +105,8 @@
105105
106106
The example creates two methods and instantiates two `LazyValue` objects with lambda expressions that call these methods. The lambda expressions do not take parameters because they just need to call a method. As the output shows, the two methods are executed only when the value of each `LazyValue` object is retrieved.
107107
108-
[!code-csharp[System.Func~1#5](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Func~1/cs/Example.cs#5)]
109-
[!code-vb[System.Func~1#5](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Func~1/vb/Example.vb#5)]
108+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Func~1/cs/Example.cs" interactive="try-dotnet" id="Snippet5":::
109+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Func~1/vb/Example.vb" id="Snippet5":::
110110
111111
]]></format>
112112
</remarks>

xml/System/Type.xml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6818,9 +6818,9 @@ The <xref:System.Type.GetProperties%2A> method does not return properties in a p
68186818
## Examples
68196819
The following example retrieves the `Type` object of a user-defined class, retrieves a property of that class, and displays the property name.
68206820

6821-
[!code-cpp[Type_GetProperty1#1](~/samples/snippets/cpp/VS_Snippets_CLR/Type_GetProperty1/CPP/type_getproperty1.cpp#1)]
6822-
[!code-csharp[Type_GetProperty1#1](~/samples/snippets/csharp/VS_Snippets_CLR/Type_GetProperty1/CS/type_getproperty1.cs#1)]
6823-
[!code-vb[Type_GetProperty1#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/Type_GetProperty1/VB/type_getproperty1.vb#1)]
6821+
:::code language="cpp" source="~/samples/snippets/cpp/VS_Snippets_CLR/Type_GetProperty1/CPP/type_getproperty1.cpp" id="Snippet1":::
6822+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR/Type_GetProperty1/CS/type_getproperty1.cs" interactive="try-dotnet" id="Snippet1":::
6823+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR/Type_GetProperty1/VB/type_getproperty1.vb" id="Snippet1":::
68246824

68256825
Internally, this property is referred to in the metadata by the name "Item." Any attempt to get `PropertyInfo` using reflection must specify this internal name in order to correctly return the `PropertyInfo` property.
68266826

@@ -6934,9 +6934,9 @@ The <xref:System.Type.GetProperties%2A> method does not return properties in a p
69346934
## Examples
69356935
The following example retrieves the type of a user-defined class, retrieves a property of that class and displays the property name in accordance with the specified binding constraints.
69366936

6937-
[!code-cpp[Type_GetProperty2#1](~/samples/snippets/cpp/VS_Snippets_CLR/Type_GetProperty2/CPP/type_getproperty2.cpp#1)]
6938-
[!code-csharp[Type_GetProperty2#1](~/samples/snippets/csharp/VS_Snippets_CLR/Type_GetProperty2/CS/type_getproperty2.cs#1)]
6939-
[!code-vb[Type_GetProperty2#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/Type_GetProperty2/VB/type_getproperty2.vb#1)]
6937+
:::code language="cpp" source="~/samples/snippets/cpp/VS_Snippets_CLR/Type_GetProperty2/CPP/type_getproperty2.cpp" id="Snippet1":::
6938+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR/Type_GetProperty2/CS/type_getproperty2.cs" interactive="try-dotnet" id="Snippet1":::
6939+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR/Type_GetProperty2/VB/type_getproperty2.vb" id="Snippet1":::
69406940

69416941
]]></format>
69426942
</remarks>
@@ -7020,9 +7020,9 @@ The <xref:System.Type.GetProperties%2A> method does not return properties in a p
70207020
## Examples
70217021
The following example defines a class with one property and retrieves the name and type of the property.
70227022

7023-
[!code-cpp[Type_GetProperty_Types#1](~/samples/snippets/cpp/VS_Snippets_CLR/Type_GetProperty_Types/CPP/type_getproperty_types.cpp#1)]
7024-
[!code-csharp[Type_GetProperty_Types#1](~/samples/snippets/csharp/VS_Snippets_CLR/Type_GetProperty_Types/CS/type_getproperty_types.cs#1)]
7025-
[!code-vb[Type_GetProperty_Types#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/Type_GetProperty_Types/VB/type_getproperty_types.vb#1)]
7023+
:::code language="cpp" source="~/samples/snippets/cpp/VS_Snippets_CLR/Type_GetProperty_Types/CPP/type_getproperty_types.cpp" id="Snippet1":::
7024+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR/Type_GetProperty_Types/CS/type_getproperty_types.cs" interactive="try-dotnet" id="Snippet1":::
7025+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR/Type_GetProperty_Types/VB/type_getproperty_types.vb" id="Snippet1":::
70267026

70277027
]]></format>
70287028
</remarks>
@@ -7109,9 +7109,9 @@ The <xref:System.Type.GetProperties%2A> method does not return properties in a p
71097109
## Examples
71107110
The following example retrieves the `Type` object of a user-defined class, retrieves the property of that class, and displays the property name and type of the property as specified by the arguments passed to `GetProperty`.
71117111

7112-
[!code-cpp[Type_GetProperty3#1](~/samples/snippets/cpp/VS_Snippets_CLR/Type_GetProperty3/CPP/type_getproperty3.cpp#1)]
7113-
[!code-csharp[Type_GetProperty3#1](~/samples/snippets/csharp/VS_Snippets_CLR/Type_GetProperty3/CS/type_getproperty3.cs#1)]
7114-
[!code-vb[Type_GetProperty3#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/Type_GetProperty3/VB/type_getproperty3.vb#1)]
7112+
:::code language="cpp" source="~/samples/snippets/cpp/VS_Snippets_CLR/Type_GetProperty3/CPP/type_getproperty3.cpp" id="Snippet1":::
7113+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR/Type_GetProperty3/CS/type_getproperty3.cs" interactive="try-dotnet" id="Snippet1":::
7114+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR/Type_GetProperty3/VB/type_getproperty3.vb" id="Snippet1":::
71157115

71167116
]]></format>
71177117
</remarks>
@@ -7300,9 +7300,9 @@ The <xref:System.Type.GetProperties%2A> method does not return properties in a p
73007300
## Examples
73017301
The following example obtains a `Type` object corresponding to `MyPropertyClass`, and the indexed property of this class is retrieved using the arguments passed to the `GetProperty` method.
73027302

7303-
[!code-cpp[Type_GetProperty5#1](~/samples/snippets/cpp/VS_Snippets_CLR/Type_GetProperty5/CPP/type_getproperty2.cpp#1)]
7304-
[!code-csharp[Type_GetProperty5#1](~/samples/snippets/csharp/VS_Snippets_CLR/Type_GetProperty5/CS/type_getproperty2.cs#1)]
7305-
[!code-vb[Type_GetProperty5#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/Type_GetProperty5/VB/type_getproperty2.vb#1)]
7303+
:::code language="cpp" source="~/samples/snippets/cpp/VS_Snippets_CLR/Type_GetProperty5/CPP/type_getproperty2.cpp" id="Snippet1":::
7304+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR/Type_GetProperty5/CS/type_getproperty2.cs" interactive="try-dotnet" id="Snippet1":::
7305+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR/Type_GetProperty5/VB/type_getproperty2.vb" id="Snippet1":::
73067306

73077307
]]></format>
73087308
</remarks>

0 commit comments

Comments
 (0)