diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase/CS/remarks.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase/CS/remarks.cs index 46ff5d1c479..bbe771fbdab 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase/CS/remarks.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase/CS/remarks.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections; using System.Collections.Specialized; @@ -11,7 +11,7 @@ public DerivedCollection() { // Adds elements from an IDictionary into the new collection. public DerivedCollection( IDictionary d, Boolean bReadOnly ) { foreach ( DictionaryEntry de in d ) { - this.BaseAdd( (String) de.Key, de.Value ); + this.BaseAdd( (string) de.Key, de.Value ); } this.IsReadOnly = bReadOnly; } @@ -25,7 +25,7 @@ public DictionaryEntry this[ int index ] { } // Gets or sets the value associated with the specified key. - public Object this[ String key ] { + public Object this[ string key ] { get { return( this.BaseGet( key ) ); } @@ -34,7 +34,7 @@ public Object this[ String key ] { } } - // Gets a String array that contains all the keys in the collection. + // Gets a string array that contains all the keys in the collection. public String[] AllKeys { get { return( this.BaseGetAllKeys() ); @@ -48,7 +48,7 @@ public Array AllValues { } } - // Gets a String array that contains all the values in the collection. + // Gets a string array that contains all the values in the collection. public String[] AllStringValues { get { return( (String[]) this.BaseGetAllValues( typeof( string ) )); @@ -63,12 +63,12 @@ public Boolean HasKeys { } // Adds an entry to the collection. - public void Add( String key, Object value ) { + public void Add( string key, Object value ) { this.BaseAdd( key, value ); } // Removes an entry with the specified key from the collection. - public void Remove( String key ) { + public void Remove( string key ) { this.BaseRemove( key ); } diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.Collections.Specialized.NameValueCollection2/CS/nvc.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.Collections.Specialized.NameValueCollection2/CS/nvc.cs index e531f818233..380c58f9614 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.Collections.Specialized.NameValueCollection2/CS/nvc.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.Collections.Specialized.NameValueCollection2/CS/nvc.cs @@ -1,4 +1,4 @@ -// The following code example demonstrates several of the properties and methods of NameValueCollection. +// The following code example demonstrates several of the properties and methods of NameValueCollection. // using System; @@ -31,7 +31,7 @@ public static void Main() { String[] myStrArr = new String[myCol.Count]; myCol.CopyTo( myStrArr, 0 ); Console.WriteLine( "The string array contains:" ); - foreach ( String s in myStrArr ) + foreach ( string s in myStrArr ) Console.WriteLine( " {0}", s ); Console.WriteLine(); @@ -48,7 +48,7 @@ public static void Main() { public static void PrintKeysAndValues( NameValueCollection myCol ) { Console.WriteLine( " KEY VALUE" ); - foreach ( String s in myCol.AllKeys ) + foreach ( string s in myCol.AllKeys ) Console.WriteLine( " {0,-10} {1}", s, myCol[s] ); Console.WriteLine(); } diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.comparison`1/cs/comparisont1.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.comparison`1/cs/comparisont1.cs index f427a6cf79b..aeb17bb49a8 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.comparison`1/cs/comparisont1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.comparison`1/cs/comparisont1.cs @@ -1,4 +1,4 @@ -// +// using System; public class CityInfo @@ -25,7 +25,7 @@ public int Population public static int CompareByName(CityInfo city1, CityInfo city2) { - return String.Compare(city1.City, city2.City); + return string.Compare(city1.City, city2.City); } public static int CompareByPopulation(CityInfo city1, CityInfo city2) @@ -35,7 +35,7 @@ public static int CompareByPopulation(CityInfo city1, CityInfo city2) public static int CompareByNames(CityInfo city1, CityInfo city2) { - return String.Compare(city1.Country + city1.City, city2.Country + city2.City); + return string.Compare(city1.Country + city1.City, city2.Country + city2.City); } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.console.backgroundcolor/cs/backgroundcolor1.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.console.backgroundcolor/cs/backgroundcolor1.cs index b84cffe5f21..be11955121b 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.console.backgroundcolor/cs/backgroundcolor1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.console.backgroundcolor/cs/backgroundcolor1.cs @@ -1,4 +1,4 @@ -// +// using System; public class Example @@ -23,7 +23,7 @@ private static void WriteCharacterStrings(int start, int end, if (changeColor) Console.BackgroundColor = (ConsoleColor) ((ctr - 1) % 16); - Console.WriteLine(new String((char)(ctr + 64), 30)); + Console.WriteLine(new string((char)(ctr + 64), 30)); } } } diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.console.class/cs/example3.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.console.class/cs/example3.cs index 8c46e95dac4..ebb43d70f38 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.console.class/cs/example3.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.console.class/cs/example3.cs @@ -1,4 +1,4 @@ -// dump a range of Unicode characters as a 16x16 array +// dump a range of Unicode characters as a 16x16 array // using System; using System.IO; @@ -26,10 +26,10 @@ private static void Main(string[] args) break; case 3: if (! uint.TryParse(args[0], NumberStyles.HexNumber, null, out rangeStart)) - throw new ArgumentException(String.Format("{0} is not a valid hexadecimal number.", args[0])); + throw new ArgumentException(string.Format("{0} is not a valid hexadecimal number.", args[0])); if (!uint.TryParse(args[1], NumberStyles.HexNumber, null, out rangeEnd)) - throw new ArgumentException(String.Format("{0} is not a valid hexadecimal number.", args[1])); + throw new ArgumentException(string.Format("{0} is not a valid hexadecimal number.", args[1])); bool.TryParse(args[2], out setOutputEncodingToUnicode); break; @@ -46,9 +46,9 @@ private static void Main(string[] args) // This won't work before .NET Framework 4.5. try { // Set encoding using endianness of this system. - // We're interested in displaying individual Char objects, so + // We're interested in displaying individual char objects, so // we don't want a Unicode BOM or exceptions to be thrown on - // invalid Char values. + // invalid char values. Console.OutputEncoding = new UnicodeEncoding(! BitConverter.IsLittleEndian, false); Console.WriteLine("\nOutput encoding set to UTF-16"); } @@ -87,15 +87,15 @@ public static void DisplayRange(uint start, uint end) // Check whether the start or end range is outside of last plane. if (start > upperRange) - throw new ArgumentException(String.Format("0x{0:X5} is outside the upper range of Unicode code points (0x{1:X5})", + throw new ArgumentException(string.Format("0x{0:X5} is outside the upper range of Unicode code points (0x{1:X5})", start, upperRange)); if (end > upperRange) - throw new ArgumentException(String.Format("0x{0:X5} is outside the upper range of Unicode code points (0x{0:X5})", + throw new ArgumentException(string.Format("0x{0:X5} is outside the upper range of Unicode code points (0x{0:X5})", end, upperRange)); // Since we're using 21-bit code points, we can't use U+D800 to U+DFFF. if ((start < surrogateStart & end > surrogateStart) || (start >= surrogateStart & start <= surrogateEnd )) - throw new ArgumentException(String.Format("0x{0:X5}-0x{1:X5} includes the surrogate pair range 0x{2:X5}-0x{3:X5}", + throw new ArgumentException(string.Format("0x{0:X5}-0x{1:X5} includes the surrogate pair range 0x{2:X5}-0x{3:X5}", start, end, surrogateStart, surrogateEnd)); uint last = RoundUpToMultipleOf(0x10, end); uint first = RoundDownToMultipleOf(0x10, start); @@ -116,7 +116,7 @@ public static void DisplayRange(uint start, uint end) } else { // the cast to int is safe, since we know that val <= upperRange. - String chars = Char.ConvertFromUtf32( (int) cur); + string chars = char.ConvertFromUtf32( (int) cur); // Display a space for code points that are not valid characters. if (CharUnicodeInfo.GetUnicodeCategory(chars[0]) == UnicodeCategory.OtherNotAssigned) diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.console.class/cs/normalize1.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.console.class/cs/normalize1.cs index bb29c964660..6eebaf5ebf2 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.console.class/cs/normalize1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.console.class/cs/normalize1.cs @@ -1,4 +1,4 @@ -// +// using System; using System.IO; @@ -8,7 +8,7 @@ public static void Main() { char[] chars = { '\u0061', '\u0308' }; - string combining = new String(chars); + string combining = new string(chars); Console.WriteLine(combining); combining = combining.Normalize(); diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.console.class/cs/unicode1.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.console.class/cs/unicode1.cs index d3ef09aead0..e3750433039 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.console.class/cs/unicode1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.console.class/cs/unicode1.cs @@ -1,11 +1,11 @@ -// +// using System; public class Example { public static void Main() { - // Create a Char array for the modern Cyrillic alphabet, + // Create a char array for the modern Cyrillic alphabet, // from U+0410 to U+044F. int nChars = 0x044F - 0x0410 + 1; char[] chars = new char[nChars]; diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.console.clear/cs/clear1.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.console.clear/cs/clear1.cs index d8d69348419..46cd8c36c22 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.console.clear/cs/clear1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.console.clear/cs/clear1.cs @@ -1,4 +1,4 @@ -// +// using System; public class Example @@ -15,7 +15,7 @@ public static void Main() ConsoleColor newForeColor = ConsoleColor.White; ConsoleColor newBackColor = ConsoleColor.Black; - Char foreColorSelection = GetKeyPress("Select Text Color (B for Blue, R for Red, Y for Yellow): ", + char foreColorSelection = GetKeyPress("Select Text Color (B for Blue, R for Red, Y for Yellow): ", new Char[] { 'B', 'R', 'Y' } ); switch (foreColorSelection) { case 'B': @@ -31,7 +31,7 @@ public static void Main() newForeColor = ConsoleColor.DarkYellow; break; } - Char backColorSelection = GetKeyPress("Select Background Color (W for White, G for Green, M for Magenta): ", + char backColorSelection = GetKeyPress("Select Background Color (W for White, G for Green, M for Magenta): ", new Char[] { 'W', 'G', 'M' }); switch (backColorSelection) { case 'W': @@ -50,13 +50,13 @@ public static void Main() Console.WriteLine(); Console.Write("Enter a message to display: "); - String textToDisplay = Console.ReadLine(); + string textToDisplay = Console.ReadLine(); Console.WriteLine(); Console.ForegroundColor = newForeColor; Console.BackgroundColor = newBackColor; Console.WriteLine(textToDisplay); Console.WriteLine(); - if (Char.ToUpper(GetKeyPress("Display another message (Y/N): ", new Char[] { 'Y', 'N' } )) == 'N') + if (char.ToUpper(GetKeyPress("Display another message (Y/N): ", new Char[] { 'Y', 'N' } )) == 'N') continueFlag = false; // Restore the default settings and clear the screen. @@ -66,7 +66,7 @@ public static void Main() } while (continueFlag); } - private static Char GetKeyPress(String msg, Char[] validChars) + private static char GetKeyPress(string msg, Char[] validChars) { ConsoleKeyInfo keyPressed; bool valid = false; @@ -76,7 +76,7 @@ private static Char GetKeyPress(String msg, Char[] validChars) Console.Write(msg); keyPressed = Console.ReadKey(); Console.WriteLine(); - if (Array.Exists(validChars, ch => ch.Equals(Char.ToUpper(keyPressed.KeyChar)))) + if (Array.Exists(validChars, ch => ch.Equals(char.ToUpper(keyPressed.KeyChar)))) valid = true; } while (! valid); return keyPressed.KeyChar; diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.console.error/cs/error1.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.console.error/cs/error1.cs index 415fbbeeeb1..51f51aa5d81 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.console.error/cs/error1.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.console.error/cs/error1.cs @@ -1,4 +1,4 @@ -// +// using System; public class Example @@ -27,12 +27,12 @@ public static void Main() increment += 10; Console.Error.Write("Display multiples of {0} through {1} (y/n)? ", increment + 1, increment + 10); - Char response = Console.ReadKey(true).KeyChar; + char response = Console.ReadKey(true).KeyChar; Console.Error.WriteLine(response); if (! Console.IsOutputRedirected) Console.CursorTop--; - if (Char.ToUpperInvariant(response) == 'N') + if (char.ToUpperInvariant(response) == 'N') exitFlag = true; } }