I am using trying to use List of <T> generics in C# ASP.NET 2.0. In my code I have a a method that returns a list of objects with the following definition. Something like
public static List<Location> GetAll()
List<Location> locations = new List<Location>();
This part of using generics is OK. My problem is that I would like to pass a List of <T> to another method. The code would look something like this
protected string Locations(List<Location> locations)
string locationsString = string.Empty;
foreach(Location lc in locations)
locationsString += lc.Name + " ";
However I eceive a compilation error saying that type or namespace name 'List' could not be found.
My questions are:
- is it possible to path a List<T> ?
- what is the right syntax to do that in C# ?
Thanks in advance!