Re: [Ironruby-core] 2d array

2009-11-29 Thread Orion Edwards
... And here's a convenient helper class Array def to_2d_a(ruby_type) sub_count = self.length max_sub_len = self.map{ |a| a.length }.max ar = System::Array.CreateInstance(ruby_type.to_clr_type, sub_count, max_sub_len) self.each_with_index do |sub, idx| sub.each_with_index

Re: [Ironruby-core] 2d array

2009-11-29 Thread Orion Edwards
This worked for me: System::Array.CreateInstance(System::Object.to_clr_type, 5, 6) Getting and setting works using x[1,2] as you'd expect Cheers! On Mon, Nov 30, 2009 at 1:44 PM, Curt Hagenlocher wrote: > You can create an array using the BCL by calling Array.CreateInstance. > >From C#, it wo

Re: [Ironruby-core] 2d array

2009-11-29 Thread Curt Hagenlocher
You can create an array using the BCL by calling Array.CreateInstance. From C#, it would look like this: Array.CreateInstance(typeof(object), 5, 6)); // Equivalent to new object[5,6] I don't have IronRuby on this machine and don't want to guess at the right syntax. From: ironruby-core-boun...@