-
[C#] object to List<>C#/기초 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'C# > 기초' 카테고리의 다른 글
[C#] ASP.NET Core (0) 2025.02.26 [C#] 정규식, Regex (0) 2025.02.18 [C#] C# dll COM (0) 2025.01.21 [C#] gRPC Exception (0) 2025.01.14 [C#] List 중복 제거 (0) 2024.12.18