[Mono-list] ConvertAll<TOutput> Question
RavonTUS
RavonTUS at Yahoo.com
Fri Feb 9 12:03:39 EST 2007
Greetings,
Someone suggested this...
#if MONO
public static List<TOutput> CastConvertList<TInput,
TOutput>( List<TInput> list )
where TInput : class
where TOutput : class
{
return list.ConvertAll<TOutput>( new
Converter<TInput, TOutput>( delegate( TInput value ) { return value as
TOutput; } ) );
}
#else
public static List<TOutput> CastConvertList<TInput,
TOutput>( List<TInput> list ) where TOutput : TInput
{
return list.ConvertAll<TOutput>( new
Converter<TInput, TOutput>( delegate( TInput value ) { return
(TOutput)value; } ) );
}
#endif
RavonTUS wrote:
>
> Greetings,
>
> I have a statement that works find in Microsoft .NET2, however here in
> MONO 1.2.2.1 it is giving an error that it - Cannot convert type `TInput'
> to `TOutput'.
>
> The error is in the return.list
>
> public static List<TOutput> CastConvertList<TInput, TOutput>( List<TInput>
> list ) where TOutput : TInput
>
> {
> return list.ConvertAll<TOutput>( new Converter<TInput, TOutput>( delegate(
> TInput value ) { return (TOutput)value; } ) );
> }
>
>
>
> Several other "T" statements in my script needed to be "reworded", does
> anyone know if I have this section syntax "worded" correctly for MONO?
> Any other suggestions?
>
> -Ravon
>
--
View this message in context: http://www.nabble.com/ConvertAll%3CTOutput%3E-Question-tf3066186.html#a8889079
Sent from the Mono - General mailing list archive at Nabble.com.
More information about the Mono-list
mailing list