Skip to content

Commit f4193e3

Browse files
authored
Add try.net to a few more examples in batch 1 (#3937)
* Add try.net to 1 more example in DateTime.ToString * add try.net * fix snippet id * add try.net * add try.net/remove dupe example * add try.net * remove interactive - inner snippet tags * roll back changes * add one more * add one more
1 parent ee64f1b commit f4193e3

File tree

3 files changed

+28
-27
lines changed

3 files changed

+28
-27
lines changed

xml/System.Collections.Generic/List`1.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1514,9 +1514,9 @@
15141514
15151515
## Examples
15161516
The following example demonstrates the <xref:System.Collections.Generic.List%601.Find%2A> method on a <xref:System.Collections.Generic.List%601> that contains a simple complex object.
1517-
1518-
[!code-csharp[System.Collections.Generic.List.ContainsExists#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.collections.generic.list.containsexists/cs/program.cs#1)]
1519-
[!code-vb[System.Collections.Generic.List.ContainsExists#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.collections.generic.list.containsexists/vb/module1.vb#1)]
1517+
1518+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.collections.generic.list.containsexists/cs/program.cs" interactive="try-dotnet" id="Snippet1":::
1519+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.collections.generic.list.containsexists/vb/module1.vb" id="Snippet1":::
15201520
15211521
The following example demonstrates the find methods for the <xref:System.Collections.Generic.List%601> class. The example for the <xref:System.Collections.Generic.List%601> class contains `book` objects, of class `Book`, using the data from the [Sample XML File: Books (LINQ to XML)](https://msdn.microsoft.com/library/94252daf-6097-4625-afc2-0eb778958d4f). The `FillList` method in the example uses [LINQ to XML](https://msdn.microsoft.com/library/f0fe21e9-ee43-4a55-b91a-0800e5782c13) to parse the values from the XML to property values of the `book` objects.
15221522

xml/System/DateTime.xml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7748,9 +7748,11 @@ The value of the current <xref:System.DateTime> object is formatted using the pa
77487748
<exception cref="T:System.ArgumentOutOfRangeException">The date and time is outside the range of dates supported by the calendar used by the current culture.</exception>
77497749
<block subset="none" type="usage">
77507750
<para>The <see cref="M:System.DateTime.ToString" /> method returns the string representation of the date and time in the calendar used by the current culture. If the value of the current <see cref="T:System.DateTime" /> instance is earlier than <see cref="P:System.Globalization.Calendar.MinSupportedDateTime" /> or later than <see cref="P:System.Globalization.Calendar.MaxSupportedDateTime" />, the method throws an <see cref="T:System.ArgumentOutOfRangeException" />. The following example provides an illustration. It attempts to format a date that is outside the range of the <see cref="T:System.Globalization.HijriCalendar" /> class when the current culture is Arabic (Syria).
7751-
7752-
[!code-csharp[System.DateTime.ToString.ArgumentOutOfRangeException#2](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.datetime.tostring.argumentoutofrangeexception/cs/datetime.tostring.argumentoutofrangeexception2.cs#2)]
7753-
[!code-vb[System.DateTime.ToString.ArgumentOutOfRangeException#2](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.datetime.tostring.argumentoutofrangeexception/vb/datetime.tostring.argumentoutofrangeexception2.vb#2)]</para>
7751+
7752+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.datetime.tostring.argumentoutofrangeexception/cs/datetime.tostring.argumentoutofrangeexception2.cs" interactive="try-dotnet" id="Snippet2":::
7753+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.datetime.tostring.argumentoutofrangeexception/vb/datetime.tostring.argumentoutofrangeexception2.vb" id="Snippet2":::
7754+
7755+
</para>
77547756
</block>
77557757
<altmember cref="T:System.Globalization.DateTimeFormatInfo" />
77567758
<altmember cref="T:System.Globalization.CultureInfo" />
@@ -7933,8 +7935,10 @@ The value of the current <xref:System.DateTime> object is formatted using the pa
79337935
<block subset="none" type="usage">
79347936
<para>The <see cref="M:System.DateTime.ToString(System.String)" /> method returns the string representation of the date and time in the calendar used by the current culture. If the value of the current <see cref="T:System.DateTime" /> instance is earlier than <see cref="P:System.Globalization.Calendar.MinSupportedDateTime" /> or later than <see cref="P:System.Globalization.Calendar.MaxSupportedDateTime" />, the method throws an <see cref="T:System.ArgumentOutOfRangeException" />. The following example provides an illustration. It attempts to format a date that is outside the range of the <see cref="T:System.Globalization.HebrewCalendar" /> class when the current culture is Hebrew (Israel).
79357937

7936-
[!code-csharp[System.DateTime.ToString.ArgumentOutOfRangeException#3](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.datetime.tostring.argumentoutofrangeexception/cs/datetime.tostring.argumentoutofrangeexception3.cs#3)]
7937-
[!code-vb[System.DateTime.ToString.ArgumentOutOfRangeException#3](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.datetime.tostring.argumentoutofrangeexception/vb/datetime.tostring.argumentoutofrangeexception3.vb#3)]</para>
7938+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.datetime.tostring.argumentoutofrangeexception/cs/datetime.tostring.argumentoutofrangeexception3.cs" interactive="try-dotnet" id="Snippet3":::
7939+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.datetime.tostring.argumentoutofrangeexception/vb/datetime.tostring.argumentoutofrangeexception3.vb" id="Snippet3":::
7940+
7941+
</para>
79387942
</block>
79397943
<altmember cref="T:System.Globalization.DateTimeFormatInfo" />
79407944
<altmember cref="T:System.Globalization.CultureInfo" />

xml/System/Enum.xml

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1170,8 +1170,8 @@ thisInstance And flag = flag
11701170
11711171
If `value` is a name that does not correspond to a named constant of `enumType`, the method throws an <xref:System.ArgumentException>. If `value` is the string representation of an integer that does not represent an underlying value of the `enumType` enumeration, the method returns an enumeration member whose underlying value is `value` converted to an integral type. If this behavior is undesirable, call the <xref:System.Enum.IsDefined%2A> method to ensure that a particular string representation of an integer is actually a member of `enumType`. The following example defines a `Colors` enumeration, calls the <xref:System.Enum.Parse%28System.Type%2CSystem.String%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.
11721172
1173-
[!code-csharp[System.Enum.Parse#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Enum.Parse/cs/ParseExample1.cs#1)]
1174-
[!code-vb[System.Enum.Parse#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Enum.Parse/vb/ParseExample1.vb#1)]
1173+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Enum.Parse/cs/ParseExample1.cs" interactive="try-dotnet" id="Snippet1":::
1174+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Enum.Parse/vb/ParseExample1.vb" id="Snippet1":::
11751175
11761176
This operation is case-sensitive.
11771177
@@ -1180,9 +1180,9 @@ thisInstance And flag = flag
11801180
## Examples
11811181
The following example uses the <xref:System.Enum.Parse%28System.Type%2CSystem.String%29> method to parse an array of strings that are created by calling the <xref:System.Enum.GetNames%2A> method. It also uses the <xref:System.Enum.Parse%28System.Type%2CSystem.String%29> method to parse an enumeration value that consists of a bit field.
11821182
1183-
[!code-cpp[enumparse#1](~/samples/snippets/cpp/VS_Snippets_CLR/enumparse/CPP/EnumParse.cpp#1)]
1184-
[!code-csharp[enumparse#1](~/samples/snippets/csharp/VS_Snippets_CLR/enumparse/CS/EnumParse.cs#1)]
1185-
[!code-vb[enumparse#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/enumparse/VB/EnumParse.vb#1)]
1183+
:::code language="cpp" source="~/samples/snippets/cpp/VS_Snippets_CLR/enumparse/CPP/EnumParse.cpp" id="Snippet1":::
1184+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR/enumparse/CS/EnumParse.cs" interactive="try-dotnet" id="Snippet1":::
1185+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR/enumparse/VB/EnumParse.vb" id="Snippet1":::
11861186
11871187
]]></format>
11881188
</remarks>
@@ -1261,18 +1261,15 @@ thisInstance And flag = flag
12611261
12621262
If `value` is a name that does not correspond to a named constant of `enumType`, the method throws an <xref:System.ArgumentException>. If `value` is the string representation of an integer that does not represent an underlying value of the `enumType` enumeration, the method returns an enumeration member whose underlying value is `value` converted to an integral type. If this behavior is undesirable, call the <xref:System.Enum.IsDefined%2A> method to ensure that a particular string representation of an integer is actually a member of `enumType`. The following example defines a `Colors` enumeration, calls the <xref:System.Enum.Parse%28System.Type%2CSystem.String%2CSystem.Boolean%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.
12631263
1264-
[!code-csharp[System.Enum.Parse#2](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Enum.Parse/cs/ParseExample2.cs#2)]
1265-
[!code-vb[System.Enum.Parse#2](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Enum.Parse/vb/ParseExample2.vb#2)]
1266-
12671264
The `ignoreCase` parameter specifies whether this operation is case-sensitive.
12681265
12691266
12701267
12711268
## Examples
12721269
The following example uses the <xref:System.Enum.Parse%28System.Type%2CSystem.String%2CSystem.Boolean%29> method to parse an array of strings that are created by calling the <xref:System.Enum.GetNames%2A> method. It also uses the <xref:System.Enum.Parse%28System.Type%2CSystem.String%29> method to parse an enumeration value that consists of a bit field.
12731270
1274-
[!code-csharp[System.Enum.Parse#2](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Enum.Parse/cs/ParseExample2.cs#2)]
1275-
[!code-vb[System.Enum.Parse#2](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Enum.Parse/vb/ParseExample2.vb#2)]
1271+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Enum.Parse/cs/ParseExample2.cs" interactive="try-dotnet" id="Snippet2":::
1272+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Enum.Parse/vb/ParseExample2.vb" id="Snippet2":::
12761273
12771274
]]></format>
12781275
</remarks>
@@ -2947,11 +2944,11 @@ thisInstance And flag = flag
29472944
29482945
## Examples
29492946
The following example demonstrates converting an enumerated value to a string.
2950-
2951-
[!code-cpp[Classic Enum.ToString2 Example#1](~/samples/snippets/cpp/VS_Snippets_CLR_Classic/classic Enum.ToString2 Example/CPP/source.cpp#1)]
2952-
[!code-csharp[Classic Enum.ToString2 Example#1](~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic Enum.ToString2 Example/CS/source.cs#1)]
2953-
[!code-vb[Classic Enum.ToString2 Example#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Enum.ToString2 Example/VB/source.vb#1)]
2954-
2947+
2948+
:::code language="cpp" source="~/samples/snippets/cpp/VS_Snippets_CLR_Classic/classic Enum.ToString2 Example/CPP/source.cpp" id="Snippet1":::
2949+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic Enum.ToString2 Example/CS/source.cs" interactive="try-dotnet" id="Snippet1":::
2950+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Enum.ToString2 Example/VB/source.vb" id="Snippet1":::
2951+
29552952
]]></format>
29562953
</remarks>
29572954
<block subset="none" type="usage">
@@ -3072,10 +3069,10 @@ thisInstance And flag = flag
30723069
## Examples
30733070
The following example demonstrates how to convert an enumerated value to a string.
30743071
3075-
[!code-cpp[enum.tostring#1](~/samples/snippets/cpp/VS_Snippets_CLR/enum.tostring/CPP/tostr.cpp#1)]
3076-
[!code-csharp[enum.tostring#1](~/samples/snippets/csharp/VS_Snippets_CLR/enum.tostring/CS/tostr.cs#1)]
3077-
[!code-vb[enum.tostring#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/enum.tostring/VB/tostr.vb#1)]
3078-
3072+
:::code language="cpp" source="~/samples/snippets/cpp/VS_Snippets_CLR/enum.tostring/CPP/tostr.cpp" id="Snippet1":::
3073+
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR/enum.tostring/CS/tostr.cs" interactive="try-dotnet" id="Snippet1":::
3074+
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR/enum.tostring/VB/tostr.vb" id="Snippet1":::
3075+
30793076
]]></format>
30803077
</remarks>
30813078
<exception cref="T:System.FormatException">

0 commit comments

Comments
 (0)