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

Ewen Cheslack-Postava echeslack at gmail.com
Mon Jul 19 01:31:50 EDT 2004


Hi,

I only did it this way because it was done similarly in another class.
 The ordering should not be important, although it currently follows
the order in the Microsoft docs.

I am attaching a new patch that simplifies them by moving the
IConvertible's upto the main line but still preserves the MS ordering.
 i.e., we get this:

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

I think that is clear and probably the best solution - it shows that
what is on the first line is always implemented and the what is in the
following #if block is only in the 2.0 framework.

Ewen Cheslack-Postava


On Mon, 19 Jul 2004 10:16:34 +0530, Raja R Harinath
<rharinath at novell.com> wrote:
> 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
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: generic-icomparables-2.diff
Type: text/x-patch
Size: 10138 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20040719/fe9cfc6c/attachment.bin 


More information about the Mono-devel-list mailing list