Author: sudha
Date: 2005-08-22 07:56:37 -0400 (Mon, 22 Aug 2005)
New Revision: 48650
Modified:
Log:
Minor fixes to 'StringType.F' and the 'Conversion.Val' methods
Modified:
2005-08-22 11:50:08 UTC (rev 48649)
2005-08-22 11:56:37 UTC (rev 48650)
@@ -1,3 +1,6 @@
+2005-08-22 Satya Sudha K <ksathyasudha (AT) novell (DOT) com>
+* Conversion.cs : Minor fix for the 'Val' function
+
2005-08-19 Satya Sudha K <ksathyasudha (AT) novell (DOT) com>
* Interaction.cs :
'CallByName' : Checking for the correct call type.
Modified:
2005-08-22 11:50:08 UTC (rev 48649)
2005-08-22 11:56:37 UTC (rev 48650)
@@ -704,7 +704,7 @@
}
try {
-return Val (CastToString (Expression));
+return Val (StringType.F (Expression));
}
catch {
Modified:
2005-08-22 11:50:08 UTC (rev 48649)
2005-08-22 11:56:37 UTC (rev 48650)
@@ -1,3 +1,6 @@
+2005-08-22 Satya Sudha K <ksathyasudha (AT) novell (DOT) com>
+* StringType.cs : Fixed the 'F' function
+
2005-08-02 Satya Sudha K <ksathyasudha (AT) novell (DOT) com>
* ByteType.cs, ShortType.cs, IntegerType.cs, LongType.cs,
* DecimalType.cs, SingleType.cs, DoubleType.cs :
Modified:
2005-08-22 11:50:08 UTC (rev 48649)
2005-08-22 11:56:37 UTC (rev 48650)
@@ -258,9 +258,32 @@
(Value is char[])
&& ((Array)Value).Rank == 1)
return new string(CharArrayType.F(Value));
+
+TypeCode typecode = Type.GetTypeCode (Value.GetType ());
+switch (typecode) {
+case TypeCode.Boolean:
+return FromBoolean ((bool) Value);
+case TypeCode.Byte:
+return FromByte ((byte) Value);
+case TypeCode.Int16:
+return FromShort ((short) Value);
+case TypeCode.Int32:
+return FromInteger ((int) Value);
+case TypeCode.Int64:
+return FromLong ((long) Value);
+case TypeCode.Single:
+return FromSingle ((float) Value);
+case TypeCode.Double:
+return FromDouble ((double) Value);
+case TypeCode.DateTime:
+return FromDate ((DateTime) Value);
+case TypeCode.Char:
+return FromChar ((char) Value);
+case TypeCode.Decimal:
+return FromDecimal ((decimal) Value);
+}
-return Convert.ToString(Value);
-
+throw new InvalidCastException (Utils.GetResourceString ("InvalidCast_FromTo", Value.ToString (), "String"));
}
Mono-patches maillist - Mono-patches (AT) lists (DOT) ximian.com