C#/기초

[C#][별**] object to List<>

딸기우유중독 2025. 2. 12. 11:04

 

상황 EX)

 

CommandParameter로 Items Array를 object전달

 

 

object로 Array 를 담은 형태로 전달 받음

 

var tag = ((IEnumerable)obj).Cast<object>().ToList();

 

List<object>로 Casting

 

List<ITagData>로 Casting

 

 

 


 

 

https://stackoverflow.com/questions/632570/cast-received-object-to-a-listobject-or-ienumerableobject

 

Cast received object to a List<object> or IEnumerable<object>

I'm trying to perform the following cast private void MyMethod(object myObject) { if(myObject is IEnumerable) { List<object> collection = (List<object>)myObject...

stackoverflow.com

 

 

 

728x90