[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnetlib/runtime/System Enum.cs, 1.13, 1.14
From: |
Gopal.V <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnetlib/runtime/System Enum.cs, 1.13, 1.14 |
Date: |
Mon, 21 Jul 2003 14:14:40 -0400 |
Update of /cvsroot/dotgnu-pnet/pnetlib/runtime/System
In directory subversions:/tmp/cvs-serv4944/runtime/System
Modified Files:
Enum.cs
Log Message:
Fix some enum issues
Index: Enum.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/Enum.cs,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** Enum.cs 20 Jul 2003 20:06:49 -0000 1.13
--- Enum.cs 21 Jul 2003 18:14:38 -0000 1.14
***************
*** 39,45 ****
{
Type type;
if(target == null)
{
! throw new
ArgumentNullException("target");
}
type = GetType();
--- 39,49 ----
{
Type type;
+ /* Note: this is what the ECMA spec says about
CompareTo
+ * Any positive integer: The value of the
current
+ * instance is greater than the value of
target,
+ * or target is null */
if(target == null)
{
! return 1;
}
type = GetType();
***************
*** 179,186 ****
--- 183,197 ----
value = ((Enum)value).GetEnumValue();
}
+ #if ECMA_COMPAT
else if(type != GetUnderlyingType(enumType))
{
throw new
ArgumentException(_("Arg_InvalidEnumValue"));
}
+ #else
+ /* Note: The spec does mention that "underlying
type"
+ * but this seems to be the check for
underlying type
+ * they suggest */
+ value=ToObject(enumType, value);
+ #endif
return GetEnumName(enumType, value);
}
***************
*** 639,645 ****
bool IConvertible.ToBoolean(IFormatProvider provider)
{
! throw new InvalidCastException
! (String.Format
! (_("InvalidCast_FromTo"),
"Enum", "Boolean"));
}
byte IConvertible.ToByte(IFormatProvider provider)
--- 650,656 ----
bool IConvertible.ToBoolean(IFormatProvider provider)
{
! /* Note: apparently the use of IConvertible is
! * to convert what can't be casted . */
! return Convert.ToBoolean(GetEnumValue());
}
byte IConvertible.ToByte(IFormatProvider provider)
***************
*** 661,667 ****
char IConvertible.ToChar(IFormatProvider provider)
{
! throw new InvalidCastException
! (String.Format
! (_("InvalidCast_FromTo"),
"Enum", "Char"));
}
int IConvertible.ToInt32(IFormatProvider provider)
--- 672,676 ----
char IConvertible.ToChar(IFormatProvider provider)
{
! return Convert.ToChar(GetEnumValue());
}
int IConvertible.ToInt32(IFormatProvider provider)
***************
*** 683,701 ****
float IConvertible.ToSingle(IFormatProvider provider)
{
! throw new InvalidCastException
! (String.Format
! (_("InvalidCast_FromTo"),
"Enum", "Single"));
}
double IConvertible.ToDouble(IFormatProvider provider)
{
! throw new InvalidCastException
! (String.Format
! (_("InvalidCast_FromTo"),
"Enum", "Double"));
}
Decimal IConvertible.ToDecimal(IFormatProvider provider)
{
! throw new InvalidCastException
! (String.Format
! (_("InvalidCast_FromTo"),
"Enum", "DateTime"));
}
DateTime IConvertible.ToDateTime(IFormatProvider provider)
--- 692,704 ----
float IConvertible.ToSingle(IFormatProvider provider)
{
! return Convert.ToSingle(GetEnumValue());
}
double IConvertible.ToDouble(IFormatProvider provider)
{
! return Convert.ToDouble(GetEnumValue());
}
Decimal IConvertible.ToDecimal(IFormatProvider provider)
{
! return Convert.ToDecimal(GetEnumValue());
}
DateTime IConvertible.ToDateTime(IFormatProvider provider)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnetlib/runtime/System Enum.cs, 1.13, 1.14,
Gopal.V <address@hidden> <=
- Prev by Date:
[Dotgnu-pnet-commits] CVS: pnetlib/runtime/System Int16.cs, 1.10, 1.11 Int32.cs, 1.12, 1.13 UInt32.cs, 1.9, 1.10 Int64.cs, 1.9, 1.10 UInt64.cs, 1.9, 1.10
- Next by Date:
[Dotgnu-pnet-commits] CVS: pnetlib ChangeLog,1.1171,1.1172
- Previous by thread:
[Dotgnu-pnet-commits] CVS: pnetlib/runtime/System Int16.cs, 1.10, 1.11 Int32.cs, 1.12, 1.13 UInt32.cs, 1.9, 1.10 Int64.cs, 1.9, 1.10 UInt64.cs, 1.9, 1.10
- Next by thread:
[Dotgnu-pnet-commits] CVS: pnetlib ChangeLog,1.1171,1.1172
- Index(es):