tags:

views:

519

answers:

2

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?

A: 

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
A: 

Actually, the related questions list provided the answer. Thanks anyway.

http://stackoverflow.com/questions/1175516/property-inject-an-array-with-spring-net

theiterator