class Array
        def to_clr_arr
        arr = System::Array.CreateInstance self[0].class.to_clr_type,
System::Int32.pase(self.length.to_s)
        self.each_with_index { |r, i| arr[i] = r }
        return arr
    end
end

my_csharp_class_instance.call(%w(some array).map{|x|
x.to_clr_string}.to_clr_arr)

2009/4/2 Thibaut Barrère <thibaut.barr...@gmail.com>

> Hi,
>
> while trying to call some C# code from IronRuby, I get this:
>
> my_csharp_class_instance.call(%w(some array))
>
> :0: can't convert Array into System::String[] (TypeError)
>
> Is there some easy way to construct an array of System::String ? Or a
> conversion ?
>
> cheers,
>
> -- Thibaut
>
> _______________________________________________
> Ironruby-core mailing list
> Ironruby-core@rubyforge.org
> http://rubyforge.org/mailman/listinfo/ironruby-core
>
>


-- 
Michael Letterle
IronRuby MVP
http://blog.prokrams.com
_______________________________________________
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core

Reply via email to