|
5121 | 5121 | ## Examples
|
5122 | 5122 | The following example rounds a range of <xref:System.Decimal> values between 100 and 102 to the nearest integer. Because the method uses banker's rounding, note that 100.5 rounds to 100 and 101.5 rounds to 102.
|
5123 | 5123 |
|
5124 |
| - [!code-csharp[System.Decimal.Round#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/System.Decimal.Round/cs/Round1.cs#1)] |
5125 |
| - [!code-vb[System.Decimal.Round#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/System.Decimal.Round/vb/Round1.vb#1)] |
5126 |
| - |
| 5124 | + :::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/System.Decimal.Round/cs/Round1.cs" interactive="try-dotnet" id="Snippet1"::: |
| 5125 | + :::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/System.Decimal.Round/vb/Round1.vb" id="Snippet1"::: |
| 5126 | + |
5127 | 5127 | ]]></format>
|
5128 | 5128 | </remarks>
|
5129 | 5129 | <exception cref="T:System.OverflowException">The result is outside the range of a <see cref="T:System.Decimal" /> value.</exception>
|
|
5186 | 5186 | ## Examples
|
5187 | 5187 | The following example rounds several `Decimal` values to a specified number of decimal places using the `Round` method.
|
5188 | 5188 |
|
5189 |
| - [!code-csharp[System.Decimal.Round#12](~/samples/snippets/csharp/VS_Snippets_CLR_System/System.Decimal.Round/cs/Round12.cs#12)] |
5190 |
| - [!code-vb[System.Decimal.Round#12](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/System.Decimal.Round/vb/Round12.vb#12)] |
5191 |
| - |
| 5189 | + :::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/System.Decimal.Round/cs/Round12.cs" interactive="try-dotnet" id="Snippet12"::: |
| 5190 | + :::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/System.Decimal.Round/vb/Round12.vb" id="Snippet12"::: |
| 5191 | + |
5192 | 5192 | ]]></format>
|
5193 | 5193 | </remarks>
|
5194 | 5194 | <exception cref="T:System.ArgumentOutOfRangeException">
|
|
5263 | 5263 | ## Examples
|
5264 | 5264 | The following example displays values returned by the <xref:System.Math.Round%28System.Decimal%29> method, the <xref:System.Math.Round%28System.Decimal%2CSystem.MidpointRounding%29> method with a `mode` argument of <xref:System.MidpointRounding.ToEven>, and the <xref:System.Math.Round%28System.Decimal%2CSystem.MidpointRounding%29> method with a `mode` argument of <xref:System.MidpointRounding.AwayFromZero>.
|
5265 | 5265 |
|
5266 |
| - [!code-csharp[System.Math.Round.Overload#5](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.math.round.overload/cs/midpoint1.cs#5)] |
5267 |
| - [!code-vb[System.Math.Round.Overload#5](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.math.round.overload/vb/midpoint1.vb#5)] |
5268 |
| - |
| 5266 | + :::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.math.round.overload/cs/midpoint1.cs" interactive="try-dotnet-method" id="Snippet5"::: |
| 5267 | + :::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.math.round.overload/vb/midpoint1.vb" id="Snippet5"::: |
| 5268 | + |
5269 | 5269 | ]]></format>
|
5270 | 5270 | </remarks>
|
5271 | 5271 | <exception cref="T:System.ArgumentException">
|
|
5343 | 5343 | ## Examples
|
5344 | 5344 | The following example demonstrates how to use the <xref:System.Math.Round%28System.Decimal%2CSystem.Int32%2CSystem.MidpointRounding%29> method with the <xref:System.MidpointRounding> enumeration.
|
5345 | 5345 |
|
5346 |
| - [!code-cpp[math.midpointrounding#1](~/samples/snippets/cpp/VS_Snippets_CLR/math.midpointrounding/cpp/mpr.cpp#1)] |
5347 |
| - [!code-csharp[math.midpointrounding#1](~/samples/snippets/csharp/VS_Snippets_CLR/math.midpointrounding/CS/mpr.cs#1)] |
5348 |
| - [!code-vb[math.midpointrounding#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/math.midpointrounding/VB/mpr.vb#1)] |
5349 |
| - |
| 5346 | + :::code language="cpp" source="~/samples/snippets/cpp/VS_Snippets_CLR/math.midpointrounding/cpp/mpr.cpp" id="Snippet1"::: |
| 5347 | + :::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR/math.midpointrounding/CS/mpr.cs" interactive="try-dotnet-method" id="Snippet1"::: |
| 5348 | + :::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR/math.midpointrounding/VB/mpr.vb" id="Snippet1"::: |
| 5349 | + |
5350 | 5350 | ]]></format>
|
5351 | 5351 | </remarks>
|
5352 | 5352 | <exception cref="T:System.ArgumentOutOfRangeException">
|
@@ -7601,10 +7601,10 @@ This member is an explicit interface member implementation. It can be used only
|
7601 | 7601 | ## Examples
|
7602 | 7602 | The following code example uses the `Truncate` method to discard the fractional digits of several `Decimal` values.
|
7603 | 7603 |
|
7604 |
| - [!code-cpp[System.Decimal.Flr_Neg_Rnd_Trnc#1](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Flr_Neg_Rnd_Trnc/CPP/floor_neg_trunc.cpp#1)] |
7605 |
| - [!code-csharp[System.Decimal.Flr_Neg_Rnd_Trnc#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Decimal.Flr_Neg_Rnd_Trnc/CS/floor_neg_trunc.cs#1)] |
7606 |
| - [!code-vb[System.Decimal.Flr_Neg_Rnd_Trnc#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Decimal.Flr_Neg_Rnd_Trnc/VB/floor_neg_trunc.vb#1)] |
7607 |
| - |
| 7604 | + :::code language="cpp" source="~/samples/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Flr_Neg_Rnd_Trnc/CPP/floor_neg_trunc.cpp" id="Snippet1"::: |
| 7605 | + :::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR_System/system.Decimal.Flr_Neg_Rnd_Trnc/CS/floor_neg_trunc.cs" interactive="try-dotnet" id="Snippet1"::: |
| 7606 | + :::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.Decimal.Flr_Neg_Rnd_Trnc/VB/floor_neg_trunc.vb" id="Snippet1"::: |
| 7607 | + |
7608 | 7608 | ]]></format>
|
7609 | 7609 | </remarks>
|
7610 | 7610 | <altmember cref="M:System.Decimal.Round(System.Decimal,System.Int32)" />
|
|
0 commit comments