diff --git a/snippets/csharp/VS_Snippets_CLR/math.max/CS/max.cs b/snippets/csharp/VS_Snippets_CLR/math.max/CS/max.cs
index 83237f7ab05..0835c8435ef 100644
--- a/snippets/csharp/VS_Snippets_CLR/math.max/CS/max.cs
+++ b/snippets/csharp/VS_Snippets_CLR/math.max/CS/max.cs
@@ -1,62 +1,62 @@
-//
-// This example demonstrates Math.Max()
+// This example demonstrates Math.Max()
using System;
class Sample
{
public static void Main()
{
- string str = "{0}: The greater of {1,3} and {2,3} is {3}.";
- string nl = Environment.NewLine;
-
- byte xByte1 = 1, xByte2 = 51;
- short xShort1 = -2, xShort2 = 52;
- int xInt1 = -3, xInt2 = 53;
- long xLong1 = -4, xLong2 = 54;
- float xSingle1 = 5.0f, xSingle2 = 55.0f;
- double xDouble1 = 6.0, xDouble2 = 56.0;
- Decimal xDecimal1 = 7m, xDecimal2 = 57m;
-
-// The following types are not CLS-compliant.
- sbyte xSbyte1 = 101, xSbyte2 = 111;
- ushort xUshort1 = 102, xUshort2 = 112;
- uint xUint1 = 103, xUint2 = 113;
- ulong xUlong1 = 104, xUlong2 = 114;
-
- Console.WriteLine("{0}Display the greater of two values:{0}", nl);
- Console.WriteLine(str, "Byte ", xByte1, xByte2, Math.Max(xByte1, xByte2));
- Console.WriteLine(str, "Int16 ", xShort1, xShort2, Math.Max(xShort1, xShort2));
- Console.WriteLine(str, "Int32 ", xInt1, xInt2, Math.Max(xInt1, xInt2));
- Console.WriteLine(str, "Int64 ", xLong1, xLong2, Math.Max(xLong1, xLong2));
- Console.WriteLine(str, "Single ", xSingle1, xSingle2, Math.Max(xSingle1, xSingle2));
- Console.WriteLine(str, "Double ", xDouble1, xDouble2, Math.Max(xDouble1, xDouble2));
- Console.WriteLine(str, "Decimal", xDecimal1, xDecimal2, Math.Max(xDecimal1, xDecimal2));
-//
- Console.WriteLine("{0}The following types are not CLS-compliant.{0}", nl);
- Console.WriteLine(str, "SByte ", xSbyte1, xSbyte2, Math.Max(xSbyte1, xSbyte2));
- Console.WriteLine(str, "UInt16 ", xUshort1, xUshort2, Math.Max(xUshort1, xUshort2));
- Console.WriteLine(str, "UInt32 ", xUint1, xUint2, Math.Max(xUint1, xUint2));
- Console.WriteLine(str, "UInt64 ", xUlong1, xUlong2, Math.Max(xUlong1, xUlong2));
+ //
+ string str = "{0}: The greater of {1,3} and {2,3} is {3}.";
+
+ byte xByte1 = 1, xByte2 = 51;
+ short xShort1 = -2, xShort2 = 52;
+ int xInt1 = -3, xInt2 = 53;
+ long xLong1 = -4, xLong2 = 54;
+ float xSingle1 = 5.0f, xSingle2 = 55.0f;
+ double xDouble1 = 6.0, xDouble2 = 56.0;
+ Decimal xDecimal1 = 7m, xDecimal2 = 57m;
+
+ // The following types are not CLS-compliant.
+ sbyte xSbyte1 = 101, xSbyte2 = 111;
+ ushort xUshort1 = 102, xUshort2 = 112;
+ uint xUint1 = 103, xUint2 = 113;
+ ulong xUlong1 = 104, xUlong2 = 114;
+
+ Console.WriteLine("Display the greater of two values:\n");
+ Console.WriteLine(str, "Byte ", xByte1, xByte2, Math.Max(xByte1, xByte2));
+ Console.WriteLine(str, "Int16 ", xShort1, xShort2, Math.Max(xShort1, xShort2));
+ Console.WriteLine(str, "Int32 ", xInt1, xInt2, Math.Max(xInt1, xInt2));
+ Console.WriteLine(str, "Int64 ", xLong1, xLong2, Math.Max(xLong1, xLong2));
+ Console.WriteLine(str, "Single ", xSingle1, xSingle2, Math.Max(xSingle1, xSingle2));
+ Console.WriteLine(str, "Double ", xDouble1, xDouble2, Math.Max(xDouble1, xDouble2));
+ Console.WriteLine(str, "Decimal", xDecimal1, xDecimal2, Math.Max(xDecimal1, xDecimal2));
+
+ Console.WriteLine("\nThe following types are not CLS-compliant.\n");
+ Console.WriteLine(str, "SByte ", xSbyte1, xSbyte2, Math.Max(xSbyte1, xSbyte2));
+ Console.WriteLine(str, "UInt16 ", xUshort1, xUshort2, Math.Max(xUshort1, xUshort2));
+ Console.WriteLine(str, "UInt32 ", xUint1, xUint2, Math.Max(xUint1, xUint2));
+ Console.WriteLine(str, "UInt64 ", xUlong1, xUlong2, Math.Max(xUlong1, xUlong2));
+
+ /*
+ This example produces the following results:
+
+ Display the greater of two values:
+
+ Byte : The greater of 1 and 51 is 51.
+ Int16 : The greater of -2 and 52 is 52.
+ Int32 : The greater of -3 and 53 is 53.
+ Int64 : The greater of -4 and 54 is 54.
+ Single : The greater of 5 and 55 is 55.
+ Double : The greater of 6 and 56 is 56.
+ Decimal: The greater of 7 and 57 is 57.
+
+ (The following types are not CLS-compliant.)
+
+ SByte : The greater of 101 and 111 is 111.
+ UInt16 : The greater of 102 and 112 is 112.
+ UInt32 : The greater of 103 and 113 is 113.
+ UInt64 : The greater of 104 and 114 is 114.
+ */
+ //
}
}
-/*
-This example produces the following results:
-
-Display the greater of two values:
-
-Byte : The greater of 1 and 51 is 51.
-Int16 : The greater of -2 and 52 is 52.
-Int32 : The greater of -3 and 53 is 53.
-Int64 : The greater of -4 and 54 is 54.
-Single : The greater of 5 and 55 is 55.
-Double : The greater of 6 and 56 is 56.
-Decimal: The greater of 7 and 57 is 57.
-
-(The following types are not CLS-compliant.)
-
-SByte : The greater of 101 and 111 is 111.
-UInt16 : The greater of 102 and 112 is 112.
-UInt32 : The greater of 103 and 113 is 113.
-UInt64 : The greater of 104 and 114 is 114.
-*/
-//
\ No newline at end of file
diff --git a/snippets/csharp/VS_Snippets_CLR/math.min/CS/min.cs b/snippets/csharp/VS_Snippets_CLR/math.min/CS/min.cs
index 8fa419a0c07..c68c513f880 100644
--- a/snippets/csharp/VS_Snippets_CLR/math.min/CS/min.cs
+++ b/snippets/csharp/VS_Snippets_CLR/math.min/CS/min.cs
@@ -1,62 +1,62 @@
-//
-// This example demonstrates Math.Min()
+// This example demonstrates Math.Min()
using System;
class Sample
{
public static void Main()
{
- string str = "{0}: The lesser of {1,3} and {2,3} is {3}.";
- string nl = Environment.NewLine;
-
- byte xByte1 = 1, xByte2 = 51;
- short xShort1 = -2, xShort2 = 52;
- int xInt1 = -3, xInt2 = 53;
- long xLong1 = -4, xLong2 = 54;
- float xSingle1 = 5.0f, xSingle2 = 55.0f;
- double xDouble1 = 6.0, xDouble2 = 56.0;
- Decimal xDecimal1 = 7m, xDecimal2 = 57m;
-
-// The following types are not CLS-compliant.
- sbyte xSbyte1 = 101, xSbyte2 = 111;
- ushort xUshort1 = 102, xUshort2 = 112;
- uint xUint1 = 103, xUint2 = 113;
- ulong xUlong1 = 104, xUlong2 = 114;
-
- Console.WriteLine("{0}Display the lesser of two values:{0}", nl);
- Console.WriteLine(str, "Byte ", xByte1, xByte2, Math.Min(xByte1, xByte2));
- Console.WriteLine(str, "Int16 ", xShort1, xShort2, Math.Min(xShort1, xShort2));
- Console.WriteLine(str, "Int32 ", xInt1, xInt2, Math.Min(xInt1, xInt2));
- Console.WriteLine(str, "Int64 ", xLong1, xLong2, Math.Min(xLong1, xLong2));
- Console.WriteLine(str, "Single ", xSingle1, xSingle2, Math.Min(xSingle1, xSingle2));
- Console.WriteLine(str, "Double ", xDouble1, xDouble2, Math.Min(xDouble1, xDouble2));
- Console.WriteLine(str, "Decimal", xDecimal1, xDecimal2, Math.Min(xDecimal1, xDecimal2));
-//
- Console.WriteLine("{0}The following types are not CLS-compliant:{0}", nl);
- Console.WriteLine(str, "SByte ", xSbyte1, xSbyte2, Math.Min(xSbyte1, xSbyte2));
- Console.WriteLine(str, "UInt16 ", xUshort1, xUshort2, Math.Min(xUshort1, xUshort2));
- Console.WriteLine(str, "UInt32 ", xUint1, xUint2, Math.Min(xUint1, xUint2));
- Console.WriteLine(str, "UInt64 ", xUlong1, xUlong2, Math.Min(xUlong1, xUlong2));
+ //
+ string str = "{0}: The lesser of {1,3} and {2,3} is {3}.";
+
+ byte xByte1 = 1, xByte2 = 51;
+ short xShort1 = -2, xShort2 = 52;
+ int xInt1 = -3, xInt2 = 53;
+ long xLong1 = -4, xLong2 = 54;
+ float xSingle1 = 5.0f, xSingle2 = 55.0f;
+ double xDouble1 = 6.0, xDouble2 = 56.0;
+ Decimal xDecimal1 = 7m, xDecimal2 = 57m;
+
+ // The following types are not CLS-compliant.
+ sbyte xSbyte1 = 101, xSbyte2 = 111;
+ ushort xUshort1 = 102, xUshort2 = 112;
+ uint xUint1 = 103, xUint2 = 113;
+ ulong xUlong1 = 104, xUlong2 = 114;
+
+ Console.WriteLine("Display the lesser of two values:\n");
+ Console.WriteLine(str, "Byte ", xByte1, xByte2, Math.Min(xByte1, xByte2));
+ Console.WriteLine(str, "Int16 ", xShort1, xShort2, Math.Min(xShort1, xShort2));
+ Console.WriteLine(str, "Int32 ", xInt1, xInt2, Math.Min(xInt1, xInt2));
+ Console.WriteLine(str, "Int64 ", xLong1, xLong2, Math.Min(xLong1, xLong2));
+ Console.WriteLine(str, "Single ", xSingle1, xSingle2, Math.Min(xSingle1, xSingle2));
+ Console.WriteLine(str, "Double ", xDouble1, xDouble2, Math.Min(xDouble1, xDouble2));
+ Console.WriteLine(str, "Decimal", xDecimal1, xDecimal2, Math.Min(xDecimal1, xDecimal2));
+
+ Console.WriteLine("\nThe following types are not CLS-compliant:\n");
+ Console.WriteLine(str, "SByte ", xSbyte1, xSbyte2, Math.Min(xSbyte1, xSbyte2));
+ Console.WriteLine(str, "UInt16 ", xUshort1, xUshort2, Math.Min(xUshort1, xUshort2));
+ Console.WriteLine(str, "UInt32 ", xUint1, xUint2, Math.Min(xUint1, xUint2));
+ Console.WriteLine(str, "UInt64 ", xUlong1, xUlong2, Math.Min(xUlong1, xUlong2));
+
+ /*
+ This example produces the following results:
+
+ Display the lesser of two values:
+
+ Byte : The lesser of 1 and 51 is 1.
+ Int16 : The lesser of -2 and 52 is -2.
+ Int32 : The lesser of -3 and 53 is -3.
+ Int64 : The lesser of -4 and 54 is -4.
+ Single : The lesser of 5 and 55 is 5.
+ Double : The lesser of 6 and 56 is 6.
+ Decimal: The lesser of 7 and 57 is 7.
+
+ The following types are not CLS-compliant:
+
+ SByte : The lesser of 101 and 111 is 101.
+ UInt16 : The lesser of 102 and 112 is 102.
+ UInt32 : The lesser of 103 and 113 is 103.
+ UInt64 : The lesser of 104 and 114 is 104.
+ */
+ //
}
}
-/*
-This example produces the following results:
-
-Display the lesser of two values:
-
-Byte : The lesser of 1 and 51 is 1.
-Int16 : The lesser of -2 and 52 is -2.
-Int32 : The lesser of -3 and 53 is -3.
-Int64 : The lesser of -4 and 54 is -4.
-Single : The lesser of 5 and 55 is 5.
-Double : The lesser of 6 and 56 is 6.
-Decimal: The lesser of 7 and 57 is 7.
-
-The following types are not CLS-compliant:
-
-SByte : The lesser of 101 and 111 is 101.
-UInt16 : The lesser of 102 and 112 is 102.
-UInt32 : The lesser of 103 and 113 is 103.
-UInt64 : The lesser of 104 and 114 is 104.
-*/
-//
\ No newline at end of file
diff --git a/snippets/csharp/VS_Snippets_CLR_System/system.Math.Abs/cs/Abs1.cs b/snippets/csharp/VS_Snippets_CLR_System/system.Math.Abs/cs/Abs1.cs
index 3f8a47e8430..d622d3886ad 100644
--- a/snippets/csharp/VS_Snippets_CLR_System/system.Math.Abs/cs/Abs1.cs
+++ b/snippets/csharp/VS_Snippets_CLR_System/system.Math.Abs/cs/Abs1.cs
@@ -1,22 +1,21 @@
-//
-using System;
+using System;
public class Example
{
public static void Main()
{
+ //
decimal[] decimals = { Decimal.MaxValue, 12.45M, 0M, -19.69M,
Decimal.MinValue };
foreach (decimal value in decimals)
- Console.WriteLine("Abs({0}) = {1}", value, Math.Abs(value));
+ Console.WriteLine($"Abs({value}) = {Math.Abs(value)}");
+ // The example displays the following output:
+ // Abs(79228162514264337593543950335) = 79228162514264337593543950335
+ // Abs(12.45) = 12.45
+ // Abs(0) = 0
+ // Abs(-19.69) = 19.69
+ // Abs(-79228162514264337593543950335) = 79228162514264337593543950335
+ //
}
}
-// The example displays the following output:
-// Abs(79228162514264337593543950335) = 79228162514264337593543950335
-// Abs(12.45) = 12.45
-// Abs(0) = 0
-// Abs(-19.69) = 19.69
-// Abs(-79228162514264337593543950335) = 79228162514264337593543950335
-//
-
diff --git a/snippets/csharp/VS_Snippets_CLR_System/system.Math.Abs/cs/abs2.cs b/snippets/csharp/VS_Snippets_CLR_System/system.Math.Abs/cs/abs2.cs
index 2f6b1c70043..329559c05c0 100644
--- a/snippets/csharp/VS_Snippets_CLR_System/system.Math.Abs/cs/abs2.cs
+++ b/snippets/csharp/VS_Snippets_CLR_System/system.Math.Abs/cs/abs2.cs
@@ -1,23 +1,24 @@
-//
-using System;
+using System;
public class Example
{
public static void Main()
{
+ //
double[] doubles = { Double.MaxValue, 16.354e-17, 15.098123, 0,
-19.069713, -15.058e18, Double.MinValue };
foreach (double value in doubles)
- Console.WriteLine("Abs({0}) = {1}", value, Math.Abs(value));
+ Console.WriteLine($"Abs({value}) = {Math.Abs(value)}");
+
+ // The example displays the following output:
+ // Abs(1.79769313486232E+308) = 1.79769313486232E+308
+ // Abs(1.6354E-16) = 1.6354E-16
+ // Abs(15.098123) = 15.098123
+ // Abs(0) = 0
+ // Abs(-19.069713) = 19.069713
+ // Abs(-1.5058E+19) = 1.5058E+19
+ // Abs(-1.79769313486232E+308) = 1.79769313486232E+308
+ //
}
}
-// The example displays the following output:
-// Abs(1.79769313486232E+308) = 1.79769313486232E+308
-// Abs(1.6354E-16) = 1.6354E-16
-// Abs(15.098123) = 15.098123
-// Abs(0) = 0
-// Abs(-19.069713) = 19.069713
-// Abs(-1.5058E+19) = 1.5058E+19
-// Abs(-1.79769313486232E+308) = 1.79769313486232E+308
-//
diff --git a/snippets/csharp/VS_Snippets_CLR_System/system.Math.Abs/cs/abs3.cs b/snippets/csharp/VS_Snippets_CLR_System/system.Math.Abs/cs/abs3.cs
index 138d2a0d8ea..e2b3ee147c4 100644
--- a/snippets/csharp/VS_Snippets_CLR_System/system.Math.Abs/cs/abs3.cs
+++ b/snippets/csharp/VS_Snippets_CLR_System/system.Math.Abs/cs/abs3.cs
@@ -1,27 +1,28 @@
-//
-using System;
+using System;
public class Example
{
public static void Main()
{
+ //
short[] values = { Int16.MaxValue, 10328, 0, -1476, Int16.MinValue };
foreach (short value in values)
{
try {
- Console.WriteLine("Abs({0}) = {1}", value, Math.Abs(value));
+ Console.WriteLine($"Abs({value}) = {Math.Abs(value)}");
}
catch (OverflowException) {
Console.WriteLine("Unable to calculate the absolute value of {0}.",
value);
}
}
+
+ // The example displays the following output:
+ // Abs(32767) = 32767
+ // Abs(10328) = 10328
+ // Abs(0) = 0
+ // Abs(-1476) = 1476
+ // Unable to calculate the absolute value of -32768.
+ //
}
}
-// The example displays the following output:
-// Abs(32767) = 32767
-// Abs(10328) = 10328
-// Abs(0) = 0
-// Abs(-1476) = 1476
-// Unable to calculate the absolute value of -32768.
-//
diff --git a/snippets/csharp/VS_Snippets_CLR_System/system.Math.Abs/cs/abs4.cs b/snippets/csharp/VS_Snippets_CLR_System/system.Math.Abs/cs/abs4.cs
index a5c9a816349..aeb14037ab1 100644
--- a/snippets/csharp/VS_Snippets_CLR_System/system.Math.Abs/cs/abs4.cs
+++ b/snippets/csharp/VS_Snippets_CLR_System/system.Math.Abs/cs/abs4.cs
@@ -1,27 +1,28 @@
-//
-using System;
+using System;
public class Example
{
public static void Main()
{
+ //
int[] values = { Int32.MaxValue, 16921, 0, -804128, Int32.MinValue };
foreach (int value in values)
{
try {
- Console.WriteLine("Abs({0}) = {1}", value, Math.Abs(value));
+ Console.WriteLine($"Abs({value}) = {Math.Abs(value)}");
}
catch (OverflowException) {
Console.WriteLine("Unable to calculate the absolute value of {0}.",
value);
}
}
+
+ // The example displays the following output:
+ // Abs(2147483647) = 2147483647
+ // Abs(16921) = 16921
+ // Abs(0) = 0
+ // Abs(-804128) = 804128
+ // Unable to calculate the absolute value of -2147483648.
+ //
}
}
-// The example displays the following output:
-// Abs(2147483647) = 2147483647
-// Abs(16921) = 16921
-// Abs(0) = 0
-// Abs(-804128) = 804128
-// Unable to calculate the absolute value of -2147483648.
-//
diff --git a/snippets/csharp/VS_Snippets_CLR_System/system.Math.Abs/cs/abs5.cs b/snippets/csharp/VS_Snippets_CLR_System/system.Math.Abs/cs/abs5.cs
index add7bb3a683..8ae4987b604 100644
--- a/snippets/csharp/VS_Snippets_CLR_System/system.Math.Abs/cs/abs5.cs
+++ b/snippets/csharp/VS_Snippets_CLR_System/system.Math.Abs/cs/abs5.cs
@@ -1,27 +1,28 @@
-//
-using System;
+using System;
public class Example
{
public static void Main()
{
+ //
long[] values = { Int64.MaxValue, 109013, 0, -6871982, Int64.MinValue };
foreach (long value in values)
{
try {
- Console.WriteLine("Abs({0}) = {1}", value, Math.Abs(value));
+ Console.WriteLine($"Abs({value}) = {Math.Abs(value)}");
}
catch (OverflowException) {
Console.WriteLine("Unable to calculate the absolute value of {0}.",
value);
}
}
+
+ // The example displays the following output:
+ // Abs(9223372036854775807) = 9223372036854775807
+ // Abs(109013) = 109013
+ // Abs(0) = 0
+ // Abs(-6871982) = 6871982
+ // Unable to calculate the absolute value of -9223372036854775808.
+ //
}
}
-// The example displays the following output:
-// Abs(9223372036854775807) = 9223372036854775807
-// Abs(109013) = 109013
-// Abs(0) = 0
-// Abs(-6871982) = 6871982
-// Unable to calculate the absolute value of -9223372036854775808.
-//
diff --git a/snippets/csharp/VS_Snippets_CLR_System/system.Math.Abs/cs/abs6.cs b/snippets/csharp/VS_Snippets_CLR_System/system.Math.Abs/cs/abs6.cs
index 5239893bece..ff5f8eade79 100644
--- a/snippets/csharp/VS_Snippets_CLR_System/system.Math.Abs/cs/abs6.cs
+++ b/snippets/csharp/VS_Snippets_CLR_System/system.Math.Abs/cs/abs6.cs
@@ -1,27 +1,28 @@
-//
-using System;
+using System;
public class Example
{
public static void Main()
{
+ //
sbyte[] values = { SByte.MaxValue, 98, 0, -32, SByte.MinValue };
foreach (sbyte value in values)
{
try {
- Console.WriteLine("Abs({0}) = {1}", value, Math.Abs(value));
+ Console.WriteLine($"Abs({value}) = {Math.Abs(value)}");
}
catch (OverflowException) {
Console.WriteLine("Unable to calculate the absolute value of {0}.",
value);
}
}
+
+ // The example displays the following output:
+ // Abs(127) = 127
+ // Abs(98) = 98
+ // Abs(0) = 0
+ // Abs(-32) = 32
+ // Unable to calculate the absolute value of -128.
+ //
}
}
-// The example displays the following output:
-// Abs(127) = 127
-// Abs(98) = 98
-// Abs(0) = 0
-// Abs(-32) = 32
-// Unable to calculate the absolute value of -128.
-//
diff --git a/snippets/csharp/VS_Snippets_CLR_System/system.Math.Abs/cs/abs7.cs b/snippets/csharp/VS_Snippets_CLR_System/system.Math.Abs/cs/abs7.cs
index 7daf1a81b05..30e320a4e15 100644
--- a/snippets/csharp/VS_Snippets_CLR_System/system.Math.Abs/cs/abs7.cs
+++ b/snippets/csharp/VS_Snippets_CLR_System/system.Math.Abs/cs/abs7.cs
@@ -1,23 +1,24 @@
-//
-using System;
+using System;
public class Example
{
public static void Main()
{
+ //
float[] values= { Single.MaxValue, 16.354e-12F, 15.098123F, 0F,
-19.069713F, -15.058e17F, Single.MinValue };
foreach (float value in values)
- Console.WriteLine("Abs({0}) = {1}", value, Math.Abs(value));
+ Console.WriteLine($"Abs({value}) = {Math.Abs(value)}");
+
+ // The example displays the following output:
+ // Abs(3.402823E+38) = 3.402823E+38
+ // Abs(1.6354E-11) = 1.6354E-11
+ // Abs(15.09812) = 15.09812
+ // Abs(0) = 0
+ // Abs(-19.06971) = 19.06971
+ // Abs(-1.5058E+18) = 1.5058E+18
+ // Abs(-3.402823E+38) = 3.402823E+38
+ //
}
}
-// The example displays the following output:
-// Abs(3.402823E+38) = 3.402823E+38
-// Abs(1.6354E-11) = 1.6354E-11
-// Abs(15.09812) = 15.09812
-// Abs(0) = 0
-// Abs(-19.06971) = 19.06971
-// Abs(-1.5058E+18) = 1.5058E+18
-// Abs(-3.402823E+38) = 3.402823E+38
-//
diff --git a/snippets/csharp/VS_Snippets_CLR_System/system.math.pow/cs/pow1.cs b/snippets/csharp/VS_Snippets_CLR_System/system.math.pow/cs/pow1.cs
index 94ae2b89163..06b94f68ca9 100644
--- a/snippets/csharp/VS_Snippets_CLR_System/system.math.pow/cs/pow1.cs
+++ b/snippets/csharp/VS_Snippets_CLR_System/system.math.pow/cs/pow1.cs
@@ -1,48 +1,48 @@
-//
-using System;
+using System;
public class Example
{
public static void Main()
{
+ //
int value = 2;
for (int power = 0; power <= 32; power++)
- Console.WriteLine("{0}^{1} = {2:N0} (0x{2:X})",
- value, power, (long)Math.Pow(value, power));
+ Console.WriteLine($"{value}^{power} = {(long)Math.Pow(value, power):N0} (0x{(long)Math.Pow(value, power):X})");
+
+ // The example displays the following output:
+ // 2^0 = 1 (0x1)
+ // 2^1 = 2 (0x2)
+ // 2^2 = 4 (0x4)
+ // 2^3 = 8 (0x8)
+ // 2^4 = 16 (0x10)
+ // 2^5 = 32 (0x20)
+ // 2^6 = 64 (0x40)
+ // 2^7 = 128 (0x80)
+ // 2^8 = 256 (0x100)
+ // 2^9 = 512 (0x200)
+ // 2^10 = 1,024 (0x400)
+ // 2^11 = 2,048 (0x800)
+ // 2^12 = 4,096 (0x1000)
+ // 2^13 = 8,192 (0x2000)
+ // 2^14 = 16,384 (0x4000)
+ // 2^15 = 32,768 (0x8000)
+ // 2^16 = 65,536 (0x10000)
+ // 2^17 = 131,072 (0x20000)
+ // 2^18 = 262,144 (0x40000)
+ // 2^19 = 524,288 (0x80000)
+ // 2^20 = 1,048,576 (0x100000)
+ // 2^21 = 2,097,152 (0x200000)
+ // 2^22 = 4,194,304 (0x400000)
+ // 2^23 = 8,388,608 (0x800000)
+ // 2^24 = 16,777,216 (0x1000000)
+ // 2^25 = 33,554,432 (0x2000000)
+ // 2^26 = 67,108,864 (0x4000000)
+ // 2^27 = 134,217,728 (0x8000000)
+ // 2^28 = 268,435,456 (0x10000000)
+ // 2^29 = 536,870,912 (0x20000000)
+ // 2^30 = 1,073,741,824 (0x40000000)
+ // 2^31 = 2,147,483,648 (0x80000000)
+ // 2^32 = 4,294,967,296 (0x100000000)
+ //
}
}
-// The example displays the following output:
-// 2^0 = 1 (0x1)
-// 2^1 = 2 (0x2)
-// 2^2 = 4 (0x4)
-// 2^3 = 8 (0x8)
-// 2^4 = 16 (0x10)
-// 2^5 = 32 (0x20)
-// 2^6 = 64 (0x40)
-// 2^7 = 128 (0x80)
-// 2^8 = 256 (0x100)
-// 2^9 = 512 (0x200)
-// 2^10 = 1,024 (0x400)
-// 2^11 = 2,048 (0x800)
-// 2^12 = 4,096 (0x1000)
-// 2^13 = 8,192 (0x2000)
-// 2^14 = 16,384 (0x4000)
-// 2^15 = 32,768 (0x8000)
-// 2^16 = 65,536 (0x10000)
-// 2^17 = 131,072 (0x20000)
-// 2^18 = 262,144 (0x40000)
-// 2^19 = 524,288 (0x80000)
-// 2^20 = 1,048,576 (0x100000)
-// 2^21 = 2,097,152 (0x200000)
-// 2^22 = 4,194,304 (0x400000)
-// 2^23 = 8,388,608 (0x800000)
-// 2^24 = 16,777,216 (0x1000000)
-// 2^25 = 33,554,432 (0x2000000)
-// 2^26 = 67,108,864 (0x4000000)
-// 2^27 = 134,217,728 (0x8000000)
-// 2^28 = 268,435,456 (0x10000000)
-// 2^29 = 536,870,912 (0x20000000)
-// 2^30 = 1,073,741,824 (0x40000000)
-// 2^31 = 2,147,483,648 (0x80000000)
-// 2^32 = 4,294,967,296 (0x100000000)
-//
diff --git a/snippets/csharp/VS_Snippets_CLR_System/system.math.sqrt/cs/sqrt1.cs b/snippets/csharp/VS_Snippets_CLR_System/system.math.sqrt/cs/sqrt1.cs
index d6003fbf43c..080d104f5d0 100644
--- a/snippets/csharp/VS_Snippets_CLR_System/system.math.sqrt/cs/sqrt1.cs
+++ b/snippets/csharp/VS_Snippets_CLR_System/system.math.sqrt/cs/sqrt1.cs
@@ -1,10 +1,10 @@
-//
-using System;
+using System;
public class Example
{
public static void Main()
{
+ //
// Create an array containing the area of some squares.
Tuple[] areas =
{ Tuple.Create("Sitka, Alaska", 2870.3),
@@ -20,15 +20,16 @@ public static void Main()
foreach (var area in areas)
Console.WriteLine("{0,-18} {1,14:N1} {2,14:N2} miles per side",
area.Item1, area.Item2, Math.Round(Math.Sqrt(area.Item2), 2));
+
+ // The example displays the following output:
+ // City Area (mi.) Equivalent to a square with:
+ //
+ // Sitka, Alaska 2,870.3 53.58 miles per side
+ // New York City 302.6 17.40 miles per side
+ // Los Angeles 468.7 21.65 miles per side
+ // Detroit 138.8 11.78 miles per side
+ // Chicago 227.1 15.07 miles per side
+ // San Diego 325.2 18.03 miles per side
+ //
}
}
-// The example displays the following output:
-// City Area (mi.) Equivalent to a square with:
-//
-// Sitka, Alaska 2,870.3 53.58 miles per side
-// New York City 302.6 17.40 miles per side
-// Los Angeles 468.7 21.65 miles per side
-// Detroit 138.8 11.78 miles per side
-// Chicago 227.1 15.07 miles per side
-// San Diego 325.2 18.03 miles per side
-//