It turns out that b.methods shows a “to_a” method is available, then I
can
do :
puts b.to_a.first # woot!
→ DocumentFormat.OpenXml.Spreadsheet.Sheet
So my questions are:
why can’t I call b.first ? (maybe there’s something obvious I didn’t
see -
I assume it’s probably that)
are there better ways of writing this ?
And if you are interested to follow (I really need to wrap some ruby
sugar
around all this to make it easier to work with), I’ll push my
experiments
here:
You can’t call a C# extension method off of the object. You might try
creating a mixin to add a method_missing to catch and call the
appropriate
extensions. Otherwise, I think you have to call them as static members,
e.g.
Enumerable.First.Of(Sheet).call(b). That looks horrifying, I know. I
don’t
have IR available on this machine, or I would try it myself. Let me know
how
that goes. This seems like it will be a fairly common problem for things
like LINQ, PFx and Rx. Maybe we can come up with a simple,
one-size-fits-all
solution?
You can’t call a C# extension method off of the object. You might try
creating a mixin to add a method_missing to catch and call the appropriate
extensions. Otherwise, I think you have to call them as static members, e.g.
Enumerable.First.Of(Sheet).call(b). That looks horrifying, I know. I don’t
have IR available on this machine, or I would try it myself. Let me know how
that goes. This seems like it will be a fairly common problem for things
like LINQ, PFx and Rx. Maybe we can come up with a simple, one-size-fits-all
solution?
yikes I was pretty sure something like that was involved.
I think I’ll try the static version first, see if it works.
thanks for the hint, I’ll keep you posted
– Thibaut
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.