0

What I'm getting at, logically, is something like this:

<object id="foobarList" type="string[]">
    <list>
        <value>foo</value>
        <value>bar</value>
    </list>
</object>

Any ideas?

theiterator
  • 335
  • 5
  • 12

1 Answers1

0

It's not quite a string[], but could you use:

<object id="foobarList" type="System.Collections.ArrayList">
    <constructor-arg>
        <list>
            <value>foo</value>
            <value>bar</value>
        </list>
    </constructor-arg>
</object>

There is a way to create a string[] as a Spring.Net object but it is remarkably painful (create a string object (hard in itself), then create a Type object using its GetType method, then pass that into the ArrayList.GetArray method to get your string[] object.

They do have some recent improvements in this area but not in a stable release yet. I'd consider writing a little factory class to make this easier, or changing the class that expects a string[] to something else.

Matt Howells
  • 40,310
  • 20
  • 83
  • 102