[Mono-devel-list] PATCH : Some generics IComparable implementations

Raja R Harinath rharinath at novell.com
Mon Jul 19 00:46:34 EDT 2004


Hi,

Ewen Cheslack-Postava <echeslack at gmail.com> writes:

> Hi all,
>
> I decided to try doing some work on generic classes and to start out I
> implemented some of the missing IComparable<T>'s in the corlib. 
> Specifically, I implemented the interface for Boolean, DateTime,
> Double, Single, TimeSpan, and Version.  The diff is attached, I would
> appreciate it if you could review it.
>
> Thanks,
> Ewen Cheslack-Postava
>
> Index: mcs/class//corlib/System/Boolean.cs
> ===================================================================
> RCS file: /mono/mcs/class/corlib/System/Boolean.cs,v
> retrieving revision 1.16
> diff -u -w -r1.16 Boolean.cs
> --- mcs/class//corlib/System/Boolean.cs	11 Jun 2004 01:59:23 -0000	1.16
> +++ mcs/class//corlib/System/Boolean.cs	18 Jul 2004 22:35:50 -0000
> @@ -48,7 +48,12 @@
>  	/// Represents the boolean values of logical true and false.
>  	/// </summary>
>  	[Serializable]
> -	public struct Boolean : IComparable, IConvertible
> +	public struct Boolean : IComparable,
> +#if NET_2_0
> +		IConvertible, IComparable<bool>
> +#else
> +		IConvertible
> +#endif

Wouldn't this be cleaner as:

         public struct Boolean : IComparable,
#if NET_2_0
                IComparable<bool>,
#endif
                IConvertible

(or, is there any specific ordering of interfaces visible to the user?)

- Hari



More information about the Mono-devel-list mailing list