C# object to array

前端 未结 5 1536
失恋的感觉
失恋的感觉 2020-12-15 04:40

Using reflection I have an object which I need to cast into an iterable list of items (type unknown, will be object). Using the Watch window I can see my object is an array

5条回答
  •  失恋的感觉
    2020-12-15 04:51

    You should be able to cast it to IEnumerable if it is a collection of any sorts (array, list, etc.). Also PropertyInfo contains a PropertyType property which you could use to find out the actual type if you wanted to.

提交回复
热议问题