Unable to cast object of type 'System.Object[]' to 'MyObject[]', what gives?

前端 未结 6 1833
忘掉有多难
忘掉有多难 2021-02-19 18:09

Scenario:

I\'m currently writing a layer to abstract 3 similar webservices into one useable class. Each webservice exposes a set of objects that share commonality. I hav

6条回答
  •  感动是毒
    2021-02-19 18:35

    That's correct, but that doesn't mean that you can cast containers of type Object to containers of other types. An Object[] is not the same thing as an Object (though you, strangely, could cast Object[] to Object).

提交回复
热议问题