Likely just missing the the appropriate using clause. Everything C# is included.
using System.Collections.Generic;
(that is also assuming the code is correct; e.g. List<> isn’t valid as it is missing a type).
Consider using VS2019 as the editor as it provides appropriate hints while editing. You may also consider adding appropriate C# extensions to Visual Studio Code to provide the same hints and compilation; but pick one and use it consistently to avoid confusion.