Ask coding questions

← Back to all posts
List<T> not working?
AureyLia

Hello, so I was trying to start out a to do list program on here (C#) but I'm having trouble just creating an empty list. I have the standard List<T> list type in my code

List<string> toDoList = new List<string>();

but I get the CS0246 error that the type or namespace "List" can't be found. What am I doing wrong?

Answered by SixBeeps [earned 5 cycles]
View Answer
Voters
AureyLia
Comments
hotnewtop
SixBeeps

The List class is a part of System.Collections and is implemented in System.Collections.Generic. Import that last one.

AureyLia

@SixBeeps thank you so much!