Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions xml/System.Globalization/Calendar.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2413,10 +2413,10 @@ Only the <xref:System.Globalization.JapaneseCalendar> and the <xref:System.Globa
## Examples
The following code example shows how the result of <xref:System.Globalization.Calendar.GetWeekOfYear%2A> varies depending on the <xref:System.Globalization.DateTimeFormatInfo.FirstDayOfWeek%2A> and the <xref:System.Globalization.CalendarWeekRule> used. If the specified date is the last day of the year, <xref:System.Globalization.Calendar.GetWeekOfYear%2A> returns the total number of weeks in that year.

[!code-cpp[System.Globalization.Calendar.GetWeekOfYear#1](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.Calendar.GetWeekOfYear/CPP/yslin_calendar_getweekofyear.cpp#1)]
[!code-csharp[System.Globalization.Calendar.GetWeekOfYear#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Globalization.Calendar.GetWeekOfYear/CS/yslin_calendar_getweekofyear.cs#1)]
[!code-vb[System.Globalization.Calendar.GetWeekOfYear#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Globalization.Calendar.GetWeekOfYear/VB/yslin_calendar_getweekofyear.vb#1)]
:::code language="cpp" source="~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.Calendar.GetWeekOfYear/CPP/yslin_calendar_getweekofyear.cpp" id="Snippet1":::
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Globalization.Calendar.GetWeekOfYear/CS/yslin_calendar_getweekofyear.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Globalization.Calendar.GetWeekOfYear/VB/yslin_calendar_getweekofyear.vb" id="Snippet1":::

]]></format>
</remarks>
<exception cref="T:System.ArgumentOutOfRangeException">
Expand Down
8 changes: 4 additions & 4 deletions xml/System.Globalization/NumberStyles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@
## Examples
This example shows how to parse a string into a 32-bit integer by using various `NumberStyles` flags.

[!code-cpp[NumberStyles#1](~/samples/snippets/cpp/VS_Snippets_CLR/NumberStyles/cpp/NumberStyles.cpp#1)]
[!code-csharp[NumberStyles#1](~/samples/snippets/csharp/VS_Snippets_CLR/NumberStyles/CS/NumberStyles.cs#1)]
[!code-vb[NumberStyles#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/NumberStyles/vb/numberstyles.vb#1)]
:::code language="cpp" source="~/samples/snippets/cpp/VS_Snippets_CLR/NumberStyles/cpp/NumberStyles.cpp" id="Snippet1":::
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR/NumberStyles/CS/NumberStyles.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR/NumberStyles/vb/numberstyles.vb" id="Snippet1":::

]]></format>
</remarks>
<altmember cref="T:System.Globalization.NumberFormatInfo" />
Expand Down
74 changes: 31 additions & 43 deletions xml/System/Array.xml
Original file line number Diff line number Diff line change
Expand Up @@ -299,10 +299,10 @@
> [!NOTE]
> The array is created with its elements in ascending sort order. The <xref:System.Array.BinarySearch%2A> method requires the array to be sorted in ascending order.

[!code-cpp[Classic Array.BinarySearch Example#1](~/samples/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.BinarySearch Example/CPP/source.cpp#1)]
[!code-csharp[Classic Array.BinarySearch Example#1](~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic Array.BinarySearch Example/CS/source.cs#1)]
[!code-vb[Classic Array.BinarySearch Example#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Array.BinarySearch Example/VB/source.vb#1)]
:::code language="cpp" source="~/samples/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.BinarySearch Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic Array.BinarySearch Example/CS/source.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Array.BinarySearch Example/VB/source.vb" id="Snippet1":::

]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">
Expand Down Expand Up @@ -716,10 +716,10 @@

The <xref:System.Array.BinarySearch%60%601(%60%600[],%60%600)> generic method overload is then used to search for two strings, one that is not in the array and one that is. The array and the return value of the <xref:System.Array.BinarySearch%2A> method are passed to the `ShowWhere` generic method, which displays the index value if the string is found, and otherwise the elements the search string would fall between if it were in the array. The index is negative if the string is not in the array, so the `ShowWhere` method takes the bitwise complement (the ~ operator in C# and Visual C++, `Xor`-1 in Visual Basic) to obtain the index of the first element in the list that is larger than the search string.

[!code-cpp[Array_SortSearch#1](~/samples/snippets/cpp/VS_Snippets_CLR/Array_SortSearch/cpp/source.cpp#1)]
[!code-csharp[Array_SortSearch#1](~/samples/snippets/csharp/VS_Snippets_CLR/Array_SortSearch/cs/source.cs#1)]
[!code-vb[Array_SortSearch#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/Array_SortSearch/vb/source.vb#1)]
:::code language="cpp" source="~/samples/snippets/cpp/VS_Snippets_CLR/Array_SortSearch/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR/Array_SortSearch/cs/source.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR/Array_SortSearch/vb/source.vb" id="Snippet1":::

]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">
Expand Down Expand Up @@ -830,10 +830,10 @@

The <xref:System.Array.BinarySearch%60%601(%60%600[],%60%600,System.Collections.Generic.IComparer{%60%600})> generic method overload is then used to search for two strings, one that is not in the array and one that is. The array and the return value of the <xref:System.Array.BinarySearch%60%601(%60%600[],%60%600,System.Collections.Generic.IComparer{%60%600})> method are passed to the `ShowWhere` generic method, which displays the index value if the string is found, and otherwise the elements the search string would fall between if it were in the array. The index is negative if the string is not n the array, so the `ShowWhere` method takes the bitwise complement (the ~ operator in C# and Visual C++, `Xor` -1 in Visual Basic) to obtain the index of the first element in the list that is larger than the search string.

[!code-cpp[Array_SortSearchComparer#1](~/samples/snippets/cpp/VS_Snippets_CLR/Array_SortSearchComparer/cpp/source.cpp#1)]
[!code-csharp[Array_SortSearchComparer#1](~/samples/snippets/csharp/VS_Snippets_CLR/Array_SortSearchComparer/cs/source.cs#1)]
[!code-vb[Array_SortSearchComparer#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/Array_SortSearchComparer/vb/source.vb#1)]
:::code language="cpp" source="~/samples/snippets/cpp/VS_Snippets_CLR/Array_SortSearchComparer/cpp/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR/Array_SortSearchComparer/cs/source.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR/Array_SortSearchComparer/vb/source.vb" id="Snippet1":::

]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">
Expand Down Expand Up @@ -1946,6 +1946,24 @@
</AssemblyInfo>
<Docs>
<summary>Copies all the elements of the current one-dimensional array to the specified one-dimensional array.</summary>
<remarks>
<format type="text/markdown"><![CDATA[

## Examples
The following code example shows how to copy an <xref:System.Array> to another <xref:System.Array>.

:::code language="cpp" source="~/samples/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CopyTo Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic Array.CopyTo Example/CS/source.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Array.CopyTo Example/VB/source.vb" id="Snippet1":::

The following code example shows how to copy an <xref:System.Array> to another <xref:System.Array> with a nonzero lower bound. Note that the entire source <xref:System.Array> is copied, including empty elements that overwrite existing elements in the target <xref:System.Array>.

:::code language="cpp" source="~/samples/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CopyTo Example/CPP/source.cpp" id="Snippet2":::
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic Array.CopyTo Example/CS/source.cs" interactive="try-dotnet-method" id="Snippet2":::
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Array.CopyTo Example/VB/source.vb" id="Snippet2":::

]]></format>
</remarks>
</Docs>
</MemberGroup>
<Member MemberName="CopyTo">
Expand Down Expand Up @@ -2006,22 +2024,7 @@
If this method throws an exception while copying, the state of `array` is undefined.

This method is an O(`n`) operation, where `n` is <xref:System.Array.Length%2A>. It performs a shallow copy only.



## Examples
The following code example shows how to copy an <xref:System.Array> to another <xref:System.Array>.

[!code-cpp[Classic Array.CopyTo Example#1](~/samples/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CopyTo Example/CPP/source.cpp#1)]
[!code-csharp[Classic Array.CopyTo Example#1](~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic Array.CopyTo Example/CS/source.cs#1)]
[!code-vb[Classic Array.CopyTo Example#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Array.CopyTo Example/VB/source.vb#1)]

The following code example shows how to copy an <xref:System.Array> to another <xref:System.Array> with a nonzero lower bound. Note that the entire source <xref:System.Array> is copied, including empty elements that overwrite existing elements in the target <xref:System.Array>.

[!code-cpp[Classic Array.CopyTo Example#2](~/samples/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CopyTo Example/CPP/source.cpp#2)]
[!code-csharp[Classic Array.CopyTo Example#2](~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic Array.CopyTo Example/CS/source.cs#2)]
[!code-vb[Classic Array.CopyTo Example#2](~/samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Array.CopyTo Example/VB/source.vb#2)]


]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">
Expand Down Expand Up @@ -2102,21 +2105,6 @@

This method is an O(`n`) operation, where `n` is <xref:System.Array.Length%2A>. It performs a shallow copy only.



## Examples
The following code example shows how to copy an <xref:System.Array> to another <xref:System.Array>.

[!code-cpp[Classic Array.CopyTo Example#1](~/samples/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CopyTo Example/CPP/source.cpp#1)]
[!code-csharp[Classic Array.CopyTo Example#1](~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic Array.CopyTo Example/CS/source.cs#1)]
[!code-vb[Classic Array.CopyTo Example#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Array.CopyTo Example/VB/source.vb#1)]

The following code example shows how to copy an <xref:System.Array> to another <xref:System.Array> with a nonzero lower bound. Note that the entire source <xref:System.Array> is copied, including empty elements that overwrite existing elements in the target <xref:System.Array>.

[!code-cpp[Classic Array.CopyTo Example#2](~/samples/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CopyTo Example/CPP/source.cpp#2)]
[!code-csharp[Classic Array.CopyTo Example#2](~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic Array.CopyTo Example/CS/source.cs#2)]
[!code-vb[Classic Array.CopyTo Example#2](~/samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic Array.CopyTo Example/VB/source.vb#2)]

]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">
Expand Down
24 changes: 12 additions & 12 deletions xml/System/DateTime.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2447,9 +2447,9 @@ The behavior of the .NET Framework and COM means that if your application round-
## Remarks
The <xref:System.DateTime.Day%2A> property always returns the day of the month in the Gregorian calendar, even if the current <xref:System.DateTime> value was instantiated using some other calendar or if the current thread culture's default calendar is not the Gregorian calendar. To retrieve the day of the month of a particular date using some other calendar, call that calendar's <xref:System.Globalization.Calendar.GetDayOfMonth%2A?displayProperty=nameWithType> method. The following example uses both the <xref:System.DateTime.Day%2A> property and the <xref:System.Globalization.HijriCalendar.GetDayOfMonth%2A?displayProperty=nameWithType> method to retrieve the day of the month for a <xref:System.DateTime> value that is instantiated using the Hijri calendar.

[!code-csharp[System.DateTime.Day#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTime.Day/cs/Day1.cs#1)]
[!code-vb[System.DateTime.Day#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.DateTime.Day/vb/Day1.vb#1)]
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTime.Day/cs/Day1.cs" interactive="try-dotnet-method" id="Snippet1":::
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.DateTime.Day/vb/Day1.vb" id="Snippet1":::

Similarly, the following example uses both the <xref:System.DateTime.Day%2A> property and the <xref:System.Globalization.HijriCalendar.GetDayOfMonth%2A?displayProperty=nameWithType> method to retrieve the day of the month when the current thread culture is ar-SA, which uses Hijri as its default calendar.

[!code-csharp[System.DateTime.Day#2](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTime.Day/cs/Day2.cs#2)]
Expand All @@ -2462,8 +2462,8 @@ The behavior of the .NET Framework and COM means that if your application round-

[!code-cpp[System.DateTime.Minute etc#1](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.DateTime.Minute etc/CPP/class1.cpp#1)]
[!code-csharp[System.DateTime.Minute etc#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTime.Minute etc/CS/class1.cs#1)]
[!code-vb[System.DateTime.Minute etc#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.DateTime.Minute etc/VB/class1.vb#1)]
[!code-vb[System.DateTime.Minute etc#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.DateTime.Minute etc/VB/class1.vb#1)]

]]></format>
</remarks>
</Docs>
Expand Down Expand Up @@ -3820,19 +3820,19 @@ juillet 2009

## Remarks
The value of the <xref:System.DateTime.Hour%2A> property is always expressed using a 24-hour clock. To retrieve a string that represents the hour of a date and time using a 12-hour clock, call the <xref:System.DateTime.ToString%28System.String%29?displayProperty=nameWithType> or <xref:System.DateTime.ToString%28System.String%2CSystem.IFormatProvider%29?displayProperty=nameWithType> method with the "h" custom format specifier. For example:
[!code-csharp[System.DateTime.Hour#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTime.Hour/cs/Hour1.cs#1)]
[!code-vb[System.DateTime.Hour#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.DateTime.Hour/vb/Hour1.vb#1)]

[!code-csharp[System.DateTime.Hour#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTime.Hour/cs/Hour1.cs#1)]
[!code-vb[System.DateTime.Hour#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.DateTime.Hour/vb/Hour1.vb#1)]



## Examples
The following example demonstrates the <xref:System.DateTime.Hour%2A> property.

[!code-cpp[System.DateTime.Minute etc#1](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.DateTime.Minute etc/CPP/class1.cpp#1)]
[!code-csharp[System.DateTime.Minute etc#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTime.Minute etc/CS/class1.cs#1)]
[!code-vb[System.DateTime.Minute etc#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.DateTime.Minute etc/VB/class1.vb#1)]
:::code language="cpp" source="~/samples/snippets/cpp/VS_Snippets_CLR_System/system.DateTime.Minute etc/CPP/class1.cpp" id="Snippet1":::
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.DateTime.Minute etc/CS/class1.cs" interactive="try-dotnet-method" id="Snippet1":::
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.DateTime.Minute etc/VB/class1.vb" id="Snippet1":::

]]></format>
</remarks>
</Docs>
Expand Down
12 changes: 6 additions & 6 deletions xml/System/Enum.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1100,9 +1100,9 @@ thisInstance And flag = flag
## Examples
The following example defines an enumeration named `PetType` that consists of individual bit fields. It then calls the <xref:System.Enum.IsDefined%2A> method with possible underlying enumeration values, string names, and composite values that result from setting multiple bit fields.

[!code-csharp[System.Enum.IsDefined#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Enum.IsDefined/cs/isdefined1.cs#1)]
[!code-vb[System.Enum.IsDefined#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Enum.IsDefined/vb/IsDefined1.vb#1)]
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Enum.IsDefined/cs/isdefined1.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Enum.IsDefined/vb/IsDefined1.vb" id="Snippet1":::

]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">
Expand All @@ -1122,9 +1122,9 @@ thisInstance And flag = flag
<block subset="none" type="usage">
<para>If <paramref name="enumType" /> is an enumeration that is defined by using the <see cref="T:System.FlagsAttribute" /> attribute, the method returns <see langword="false" /> if multiple bit fields in <paramref name="value" /> are set but <paramref name="value" /> does not correspond to a composite enumeration value, or if <paramref name="value" /> is a string concatenation of the names of multiple bit flags. In the following example, a <c>Pets</c> enumeration is defined with the <see cref="T:System.FlagsAttribute" /> attribute. The <see cref="M:System.Enum.IsDefined(System.Type,System.Object)" /> method returns <see langword="false" /> when you pass it an enumeration value that has two bit fields (<c>Pets.Dog</c> and <c>Pets.Cat</c>) set, and when you pass it the string representation of that enumeration value ("Dog, Cat").

[!code-csharp[System.Enum.IsDefined#2](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Enum.IsDefined/cs/isdefined2.cs#2)]
[!code-vb[System.Enum.IsDefined#2](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Enum.IsDefined/vb/isdefined2.vb#2)]
:::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Enum.IsDefined/cs/isdefined2.cs" interactive="try-dotnet" id="Snippet2":::
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Enum.IsDefined/vb/isdefined2.vb" id="Snippet2":::

You can determine whether multiple bit fields are set by calling the <see cref="M:System.Enum.HasFlag(System.Enum)" /> method.</para>
</block>
<altmember cref="M:System.Enum.GetName(System.Type,System.Object)" />
Expand Down
Loading