diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.Buffer.BlockCopy/CS/QuackTest.csproj b/samples/snippets/csharp/VS_Snippets_CLR_System/system.Buffer.BlockCopy/CS/QuackTest.csproj new file mode 100644 index 00000000000..48a0c930a0f --- /dev/null +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.Buffer.BlockCopy/CS/QuackTest.csproj @@ -0,0 +1,41 @@ + + + + Exe + net5 + 9.0 + buffer + true + AnyCPU;x86 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.Buffer.BlockCopy/CS/bcopy.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.Buffer.BlockCopy/CS/bcopy.cs index 19c4583cf0e..3b0b0e94206 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.Buffer.BlockCopy/CS/bcopy.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.Buffer.BlockCopy/CS/bcopy.cs @@ -1,4 +1,4 @@ -// +// using System; class Example @@ -27,7 +27,7 @@ public static void DisplayArrayValues(Array arr, string name) { // Get the length of one element in the array. int elementLength = Buffer.ByteLength(arr) / arr.Length; - string formatString = String.Format(" {{0:X{0}}}", 2 * elementLength); + string formatString = string.Format(" {{0:X{0}}}", 2 * elementLength); Console.Write( "{0,11}:", name); for (int ctr = 0; ctr < arr.Length; ctr++) Console.Write(formatString, arr.GetValue(ctr)); diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.Buffer.Bytes/CS/getbyte.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.Buffer.Bytes/CS/getbyte.cs index 5c49ebad213..ea832bdd1e3 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.Buffer.Bytes/CS/getbyte.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.Buffer.Bytes/CS/getbyte.cs @@ -1,4 +1,4 @@ -// +// // Example of the Buffer.GetByte method. using System; @@ -11,7 +11,7 @@ public static void DisplayArray( Array arr, string name ) { // Get the array element width; format the formatting string. int elemWidth = Buffer.ByteLength( arr ) / arr.Length; - string format = String.Format( " {{0:X{0}}}", 2 * elemWidth ); + string format = string.Format( " {{0:X{0}}}", 2 * elemWidth ); // Display the array elements from right to left. Console.Write( "{0,5}:", name ); @@ -26,7 +26,7 @@ public static void ArrayInfo( Array arr, string name, int index ) // Display the array name, index, and byte to be viewed. Console.WriteLine( formatter, name, index, value, - String.Format( "0x{0:X2}", value ) ); + string.Format( "0x{0:X2}", value ) ); } public static void Main( ) diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.Buffer.Bytes/CS/setbyte.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.Buffer.Bytes/CS/setbyte.cs index bf2187c64b9..eaceee2f881 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.Buffer.Bytes/CS/setbyte.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.Buffer.Bytes/CS/setbyte.cs @@ -1,4 +1,4 @@ -// +// // Example of the Buffer.SetByte method. using System; @@ -9,7 +9,7 @@ public static void DisplayArray( Array arr, string name ) { // Get the array element width; format the formatting string. int elemWidth = Buffer.ByteLength( arr ) / arr.Length; - string format = String.Format( " {{0:X{0}}}", 2 * elemWidth ); + string format = string.Format( " {{0:X{0}}}", 2 * elemWidth ); // Display the array elements from right to left. Console.Write( "{0,7}:", name ); diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.Byte Examples/CS/systembyte.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.Byte Examples/CS/systembyte.cs index 6f30a3c9f12..16ac1dcbb6a 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.Byte Examples/CS/systembyte.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.Byte Examples/CS/systembyte.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace SystemByte_Examples { @@ -12,7 +12,7 @@ static void Main(string[] args) SystemByteExamples sbe = new SystemByteExamples(); int numberToSet; Byte compareByte; -// String stringToConvert; +// string stringToConvert; numberToSet = 120; // stringToConvert = "200"; diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.Byte.ToString/CS/tostring.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.Byte.ToString/CS/tostring.cs index 9cd1522709e..ef31e96c24e 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.Byte.ToString/CS/tostring.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.Byte.ToString/CS/tostring.cs @@ -1,4 +1,4 @@ -// +// // Example for the Byte.ToString( ) methods. using System; using System.Globalization; @@ -48,9 +48,9 @@ static void Main( ) { Console.WriteLine( "This example of\n" + " Byte.ToString( ),\n" + - " Byte.ToString( String ),\n" + + " Byte.ToString( string ),\n" + " Byte.ToString( IFormatProvider ), and\n" + - " Byte.ToString( String, IFormatProvider )\n" + + " Byte.ToString( string, IFormatProvider )\n" + "generates the following output when formatting " + "Byte values \nwith combinations of format " + "strings and IFormatProvider." ); @@ -62,9 +62,9 @@ static void Main( ) /* This example of Byte.ToString( ), - Byte.ToString( String ), + Byte.ToString( string ), Byte.ToString( IFormatProvider ), and - Byte.ToString( String, IFormatProvider ) + Byte.ToString( string, IFormatProvider ) generates the following output when formatting Byte values with combinations of format strings and IFormatProvider. diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.Char [Type Level]/CS/charstructure.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.Char [Type Level]/CS/charstructure.cs index c3df6be31f5..5d655868da9 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.Char [Type Level]/CS/charstructure.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.Char [Type Level]/CS/charstructure.cs @@ -1,4 +1,4 @@ -// +// using System; public class CharStructureSample @@ -11,18 +11,18 @@ public static void Main() Console.WriteLine(chA.CompareTo('B')); //----------- Output: "-1" (meaning 'A' is 1 less than 'B') Console.WriteLine(chA.Equals('A')); //----------- Output: "True" - Console.WriteLine(Char.GetNumericValue(ch1)); //----------- Output: "1" - Console.WriteLine(Char.IsControl('\t')); //----------- Output: "True" - Console.WriteLine(Char.IsDigit(ch1)); //----------- Output: "True" - Console.WriteLine(Char.IsLetter(',')); //----------- Output: "False" - Console.WriteLine(Char.IsLower('u')); //----------- Output: "True" - Console.WriteLine(Char.IsNumber(ch1)); //----------- Output: "True" - Console.WriteLine(Char.IsPunctuation('.')); //----------- Output: "True" - Console.WriteLine(Char.IsSeparator(str, 4)); //----------- Output: "True" - Console.WriteLine(Char.IsSymbol('+')); //----------- Output: "True" - Console.WriteLine(Char.IsWhiteSpace(str, 4)); //----------- Output: "True" - Console.WriteLine(Char.Parse("S")); //----------- Output: "S" - Console.WriteLine(Char.ToLower('M')); //----------- Output: "m" + Console.WriteLine(char.GetNumericValue(ch1)); //----------- Output: "1" + Console.WriteLine(char.IsControl('\t')); //----------- Output: "True" + Console.WriteLine(char.IsDigit(ch1)); //----------- Output: "True" + Console.WriteLine(char.IsLetter(',')); //----------- Output: "False" + Console.WriteLine(char.IsLower('u')); //----------- Output: "True" + Console.WriteLine(char.IsNumber(ch1)); //----------- Output: "True" + Console.WriteLine(char.IsPunctuation('.')); //----------- Output: "True" + Console.WriteLine(char.IsSeparator(str, 4)); //----------- Output: "True" + Console.WriteLine(char.IsSymbol('+')); //----------- Output: "True" + Console.WriteLine(char.IsWhiteSpace(str, 4)); //----------- Output: "True" + Console.WriteLine(char.Parse("S")); //----------- Output: "S" + Console.WriteLine(char.ToLower('M')); //----------- Output: "m" Console.WriteLine('x'.ToString()); //----------- Output: "x" } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.boolean.structure/cs/operations1.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.boolean.structure/cs/operations1.cs index 6db1fe5efe1..2f23fe0b0ba 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.boolean.structure/cs/operations1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.boolean.structure/cs/operations1.cs @@ -1,4 +1,4 @@ -// +// using System; using System.IO; using System.Threading; @@ -10,7 +10,7 @@ public static void Main() // Initialize flag variables. bool isRedirected = false; bool isBoth = false; - String fileName = ""; + string fileName = ""; StreamWriter sw = null; // Get any command line arguments. @@ -18,7 +18,7 @@ public static void Main() // Handle any arguments. if (args.Length > 1) { for (int ctr = 1; ctr < args.Length; ctr++) { - String arg = args[ctr]; + string arg = args[ctr]; if (arg.StartsWith("/") || arg.StartsWith("-")) { switch (arg.Substring(1).ToLower()) { @@ -35,7 +35,7 @@ public static void Main() isBoth = true; break; default: - ShowSyntax(String.Format("The {0} switch is not supported", + ShowSyntax(string.Format("The {0} switch is not supported", args[ctr])); return; } @@ -55,17 +55,17 @@ public static void Main() if (!isBoth) Console.SetOut(sw); } - String msg = String.Format("Application began at {0}", DateTime.Now); + string msg = string.Format("Application began at {0}", DateTime.Now); Console.WriteLine(msg); if (isBoth) sw.WriteLine(msg); Thread.Sleep(5000); - msg = String.Format("Application ended normally at {0}", DateTime.Now); + msg = string.Format("Application ended normally at {0}", DateTime.Now); Console.WriteLine(msg); if (isBoth) sw.WriteLine(msg); if (isRedirected) sw.Close(); } - private static void ShowSyntax(String errMsg) + private static void ShowSyntax(string errMsg) { Console.WriteLine(errMsg); Console.WriteLine("\nSyntax: Example [[/f [/b]]\n"); diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.boolean.structure/cs/parse2.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.boolean.structure/cs/parse2.cs index 3fe8b739703..a9a96e6eb69 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.boolean.structure/cs/parse2.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.boolean.structure/cs/parse2.cs @@ -1,11 +1,11 @@ -// +// using System; public class Example { public static void Main() { - string[] values = { null, String.Empty, "True", "False", + string[] values = { null, string.Empty, "True", "False", "true", "false", " true ", "TrUe", "fAlSe", "fa lse", "0", "1", "-1", "string" }; diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.boolean.structure/cs/parse3.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.boolean.structure/cs/parse3.cs index 7feed3bbe83..bac42d3a643 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.boolean.structure/cs/parse3.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.boolean.structure/cs/parse3.cs @@ -1,4 +1,4 @@ -// +// using System; public class Example @@ -9,7 +9,7 @@ public static void Main() foreach (var value in values) { bool success, result; int number; - success = Int32.TryParse(value, out number); + success = int.TryParse(value, out number); if (success) { // The method throws no exceptions. result = Convert.ToBoolean(number); diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.boolean.tryparse/cs/tryparseex.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.boolean.tryparse/cs/tryparseex.cs index 11a7a9b75db..a23bd0bd8de 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.boolean.tryparse/cs/tryparseex.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.boolean.tryparse/cs/tryparseex.cs @@ -1,11 +1,11 @@ -// +// using System; public class Example { public static void Main() { - string[] values = { null, String.Empty, "True", "False", + string[] values = { null, string.Empty, "True", "False", "true", "false", " true ", "0", "1", "-1", "string" }; foreach (var value in values) {