diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/System.Convert.ToBase64String/cs/ToBase64String.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/System.Convert.ToBase64String/cs/ToBase64String.cs index d643b82f5ad..9ec7d1e9386 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/System.Convert.ToBase64String/cs/ToBase64String.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/System.Convert.ToBase64String/cs/ToBase64String.cs @@ -1,4 +1,4 @@ -// +// using System; public class Example @@ -22,7 +22,7 @@ public static void Main() } // Encode the byte array using Base64 encoding - String base64 = Convert.ToBase64String(bytes); + string base64 = Convert.ToBase64String(bytes); Console.WriteLine("The encoded string: "); for (int ctr = 0; ctr <= base64.Length / 50; ctr++) Console.WriteLine(base64.Substring(ctr * 50, diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.convert.changetype/cs/changetype00.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.convert.changetype/cs/changetype00.cs index bc4e85f595a..b5ea1df3dfe 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.convert.changetype/cs/changetype00.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.convert.changetype/cs/changetype00.cs @@ -1,4 +1,4 @@ -// +// using System; using System.Globalization; diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.convert.changetype/cs/changetype01.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.convert.changetype/cs/changetype01.cs index 470ee3846df..cdc43cea9df 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.convert.changetype/cs/changetype01.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.convert.changetype/cs/changetype01.cs @@ -1,4 +1,4 @@ -// +// using System; public class ChangeTypeTest { @@ -7,15 +7,15 @@ public static void Main() { Double d = -2.345; int i = (int)Convert.ChangeType(d, TypeCode.Int32); - Console.WriteLine("The Double {0} when converted to an Int32 is {1}", d, i); + Console.WriteLine("The Double {0} when converted to an int is {1}", d, i); string s = "12/12/2009"; DateTime dt = (DateTime)Convert.ChangeType(s, typeof(DateTime)); - Console.WriteLine("The String {0} when converted to a Date is {1}", s, dt); + Console.WriteLine("The string {0} when converted to a Date is {1}", s, dt); } } // The example displays the following output: -// The Double -2.345 when converted to an Int32 is -2 -// The String 12/12/2009 when converted to a Date is 12/12/2009 12:00:00 AM +// The Double -2.345 when converted to an int is -2 +// The string 12/12/2009 when converted to a Date is 12/12/2009 12:00:00 AM // diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.convert.changetype/cs/changetype03.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.convert.changetype/cs/changetype03.cs index c725762157e..e30ca5df548 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.convert.changetype/cs/changetype03.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.convert.changetype/cs/changetype03.cs @@ -1,4 +1,4 @@ -// +// using System; using System.Globalization; @@ -48,7 +48,7 @@ public bool ToBoolean(IFormatProvider provider) public byte ToByte(IFormatProvider provider) { if (m_Temp < Byte.MinValue || m_Temp > Byte.MaxValue) - throw new OverflowException(String.Format("{0} is out of range of the Byte type.", + throw new OverflowException(string.Format("{0} is out of range of the Byte type.", this.m_Temp)); else return Decimal.ToByte(this.m_Temp); @@ -56,7 +56,7 @@ public byte ToByte(IFormatProvider provider) public char ToChar(IFormatProvider provider) { - throw new InvalidCastException("Temperature to Char conversion is not supported."); + throw new InvalidCastException("Temperature to char conversion is not supported."); } public DateTime ToDateTime(IFormatProvider provider) @@ -77,7 +77,7 @@ public double ToDouble(IFormatProvider provider) public short ToInt16(IFormatProvider provider) { if (this.m_Temp < Int16.MinValue || this.m_Temp > Int16.MaxValue) - throw new OverflowException(String.Format("{0} is out of range of the Int16 type.", + throw new OverflowException(string.Format("{0} is out of range of the Int16 type.", this.m_Temp)); else return Decimal.ToInt16(this.m_Temp); @@ -85,8 +85,8 @@ public short ToInt16(IFormatProvider provider) public int ToInt32(IFormatProvider provider) { - if (this.m_Temp < Int32.MinValue || this.m_Temp > Int32.MaxValue) - throw new OverflowException(String.Format("{0} is out of range of the Int32 type.", + if (this.m_Temp < int.MinValue || this.m_Temp > int.MaxValue) + throw new OverflowException(string.Format("{0} is out of range of the int type.", this.m_Temp)); else return Decimal.ToInt32(this.m_Temp); @@ -95,7 +95,7 @@ public int ToInt32(IFormatProvider provider) public long ToInt64(IFormatProvider provider) { if (this.m_Temp < Int64.MinValue || this.m_Temp > Int64.MaxValue) - throw new OverflowException(String.Format("{0} is out of range of the Int64 type.", + throw new OverflowException(string.Format("{0} is out of range of the Int64 type.", this.m_Temp)); else return Decimal.ToInt64(this.m_Temp); @@ -104,7 +104,7 @@ public long ToInt64(IFormatProvider provider) public sbyte ToSByte(IFormatProvider provider) { if (this.m_Temp < SByte.MinValue || this.m_Temp > SByte.MaxValue) - throw new OverflowException(String.Format("{0} is out of range of the SByte type.", + throw new OverflowException(string.Format("{0} is out of range of the SByte type.", this.m_Temp)); else return Decimal.ToSByte(this.m_Temp); @@ -146,7 +146,7 @@ public object ToType(Type conversionType, IFormatProvider provider) if (typeof(Temperature).Equals(conversionType)) return this; else - throw new InvalidCastException(String.Format("Conversion to a {0} is not supported.", + throw new InvalidCastException(string.Format("Conversion to a {0} is not supported.", conversionType.Name)); case TypeCode.SByte: return this.ToSByte(null); @@ -161,14 +161,14 @@ public object ToType(Type conversionType, IFormatProvider provider) case TypeCode.UInt64: return this.ToUInt64(null); default: - throw new InvalidCastException(String.Format("Conversion to {0} is not supported.", conversionType.Name)); + throw new InvalidCastException(string.Format("Conversion to {0} is not supported.", conversionType.Name)); } } public ushort ToUInt16(IFormatProvider provider) { if (this.m_Temp < UInt16.MinValue || this.m_Temp > UInt16.MaxValue) - throw new OverflowException(String.Format("{0} is out of range of the UInt16 type.", + throw new OverflowException(string.Format("{0} is out of range of the UInt16 type.", this.m_Temp)); else return Decimal.ToUInt16(this.m_Temp); @@ -177,7 +177,7 @@ public ushort ToUInt16(IFormatProvider provider) public uint ToUInt32(IFormatProvider provider) { if (this.m_Temp < UInt32.MinValue || this.m_Temp > UInt32.MaxValue) - throw new OverflowException(String.Format("{0} is out of range of the UInt32 type.", + throw new OverflowException(string.Format("{0} is out of range of the UInt32 type.", this.m_Temp)); else return Decimal.ToUInt32(this.m_Temp); @@ -186,7 +186,7 @@ public uint ToUInt32(IFormatProvider provider) public ulong ToUInt64(IFormatProvider provider) { if (this.m_Temp < UInt64.MinValue || this.m_Temp > UInt64.MaxValue) - throw new OverflowException(String.Format("{0} is out of range of the UInt64 type.", + throw new OverflowException(string.Format("{0} is out of range of the UInt64 type.", this.m_Temp)); else return Decimal.ToUInt64(this.m_Temp); @@ -200,10 +200,10 @@ public class Example public static void Main() { Temperature cool = new Temperature(5); - Type[] targetTypes = { typeof(SByte), typeof(Int16), typeof(Int32), + Type[] targetTypes = { typeof(SByte), typeof(Int16), typeof(int), typeof(Int64), typeof(Byte), typeof(UInt16), typeof(UInt32), typeof(UInt64), typeof(Decimal), - typeof(Single), typeof(Double), typeof(String) }; + typeof(Single), typeof(Double), typeof(string) }; CultureInfo provider = new CultureInfo("fr-FR"); foreach (Type targetType in targetTypes) diff --git a/samples/snippets/csharp/VS_Snippets_CLR_System/system.convert.changetype/cs/changetype_nullable.cs b/samples/snippets/csharp/VS_Snippets_CLR_System/system.convert.changetype/cs/changetype_nullable.cs index 24cd78e2a70..aba07cc8150 100644 --- a/samples/snippets/csharp/VS_Snippets_CLR_System/system.convert.changetype/cs/changetype_nullable.cs +++ b/samples/snippets/csharp/VS_Snippets_CLR_System/system.convert.changetype/cs/changetype_nullable.cs @@ -1,4 +1,4 @@ -// +// using System; public class Example