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]

Open2view.com
The Real Estate Website

_______________________________________________
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core

Reply via email to