Generic methods are not supported yet.

Tomas

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Orion Edwards
Sent: Tuesday, September 09, 2008 3:44 PM
To: [email protected]
Subject: [Ironruby-core] More CLR interop questions - Generic Methods

Playing around, I see that this works



include System

Generic = System::Collections::Generic

Linq = System::Linq



# var list = new List<Int32>();

list = Generic::List[Int32].new

list.add 1

list.add 2



# list.Average();

puts Linq::Enumerable.average(list) # it knows it's a list of int32

=> 1.5


This is incredibly cool by the way, however, I can't work out how to pass types 
to a method which needs them, such as Linq's IEnumerable.Cast.
This was my best guess, and it fails



# list.Cast<Double>();

Linq::Enumerable.cast[Double](list)



I also tried



Linq::Enumerable.cast(Double, list)

Linq::Enumerable.cast(list, Double)

Linq::Enumerable.cast[Double](list)

Linq::Enumerable.cast(list)[Double]
Is this actually implemented, if so how can I use do it?
--
Orion Edwards
Web Application Developer

T: +64 7 859 2120
F: +64 7 859 2320
E: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>

Open2view.com
The Real Estate Website

[cid:[email protected]]

<<inline: image001.jpg>>

_______________________________________________
Ironruby-core mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ironruby-core

Reply via email to