Sorry, multiple constraints aren't supported yet. This is something we're working on -- you'll notice that the syntax allows it. Full support requires a change in the metadata format for constraints (among other things).
Dave. -----Original Message----- From: Jeroen Frijters [mailto:[EMAIL PROTECTED]] Sent: 05 September 2002 10:32 To: [EMAIL PROTECTED] Subject: Re: [DOTNET-ROTOR] Small Gyro bug When I specify multiple constraints for the same identifier, it doesn't work nor does the compiler give an error message. For example: class Test { public static int GetIt<T>(T v) where T : System.IConvertible, T : System.IFormattable { return v.ToInt32(); } public static void Main() { GetIt<int>(2); } } Gives the compilation error: error CS0117: 'T' does not contain a definition for 'ToInt32' I had really hoped that this would be possible, so if it isn't valid to supply multiple constraints for the same type argument, read this as a request for enhancement ;-) Regards, Jeroen P.S. I'd love to receive a copy of csharp.htm > -----Original Message----- > From: Discussion of the Rotor Shared Source CLI > implementation [mailto:[EMAIL PROTECTED]] On > Behalf Of Dave Berry (Independent Contractor) > Sent: Thursday, September 05, 2002 11:10 > To: [EMAIL PROTECTED] > Subject: Re: [DOTNET-ROTOR] Small Gyro bug > > > Thanks for the report. Regarding documentation, there's a doc file > (csharp.html) missing in the tarball. I'll add this to the tarball on > the download site, and post a message here when it's ready. If anyone > has already downloaded the release and would like a copy of this file, > please mail me directly. > > Dave. > > > -----Original Message----- > From: Jeroen Frijters [mailto:[EMAIL PROTECTED]] > Sent: 05 September 2002 09:55 > To: [EMAIL PROTECTED] > Subject: [DOTNET-ROTOR] Small Gyro bug > > When I was trying to figure out the constraint syntax (is there any > documentation that I missed?), I ran into the following: > > class test > { > public static T Func<System.IConvertible : T>(T v) { return v; } > } > > When you try to compile this, the compiler exits without any error > messages. > > BTW, for those who are interested, the correct syntax is: > > class test > { > public static T Func<T>(T v) where T : System.IConvertible > { return v; > } > } > > Regards, > Jeroen >