Try this:
<object id="MyInt" type="System.Int32" factory-method="Copy">
<constructor-arg index="0">
<value>123</value>
</constructor-arg>
</object>
Question
Kind of a simple newbie question...I see how I can create a string object, but how would I create an int object?
Here is the xml code fragment from my context file:
<object id="myString" type="System.String">
<constructor-arg value="foo" />
</object>
<object id="myInt" type="System.Int32">
<<<**** how do I set this ****>>>>
</object>
Solution
Try this:
<object id="MyInt" type="System.Int32" factory-method="Copy">
<constructor-arg index="0">
<value>123</value>
</constructor-arg>
</object>
OTHER TIPS
Try this:
<object id="MyInt" type="System.Int32" factory-method="Parse">
<constructor-arg index="0">
<value>123</value>
</constructor-arg>
</object>
For creating an object of primitive type System.Int32, you must use the factory-method="Parse". The attribute factory-method="Copy" doesn't works because it not exists in the type System.Int32 and you have to use a static method to do it.