名前空間 Device.Control に列挙があります ...
public enum State {
IN_PROGRESS, SUSPENDED, HALTED, FINISHED
}
そして、私はクラスを持っています...
public class CustomStateManager {
public IList<State> ManagingStates { get; set; }
}
そして、これがspring.netの構成XMLです...
<object id="MyStateManager" type="CustomStateManager">
<property name="ManagingStates">
<list>
<value>SUSPENDED</value>
<value>HALTED</value>
</list>
</property>
</object>
MyStateManager オブジェクトをビルドして注入しようとすると、Spring.NET は、オブジェクトの ManagingStates プロパティを設定できないと文句を言います。このエラーが発生します...
「ファイル [Spring.xml] 行 3」で定義された「MyStateManager」という名前のオブジェクトの作成中にエラーが発生しました: プロパティ値の設定エラー: PropertyAccessExceptionsException (1 エラー); [Spring.Core.TypeMismatchException: タイプ [System.Collections.ArrayList] のプロパティ値を必要なタイプ [System.Collections.Generic.IList
1[[SandboxConsole.Device.Control.ApplicationEnumerations+State, SandboxConsole, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]] for property 'ManagingStates'., Inner Exception: Spring.Core.TypeMismatchException: Cannot convert property value of type [System.Collections.ArrayList] to required type [System.Collections.Generic.IList
1[[SandboxConsole.Device.Control.ApplicationEnumerations+State, SandboxConsole,プロパティ 'ManagingStates' のバージョン = 1.0.0.0、カルチャ = ニュートラル、PublicKeyToken = null]]]...
私はSpring.NETに少し慣れていないので、ArrayListをIListプロパティに挿入できないこと以外に、ここで何が問題なのかわかりません。 値が列挙型である構成でリストを作成することは可能ですか? もしそうなら、どのように?