How to return a list of strings in C#
c#, com, visual-c++
Solution
List<string> or string[] are the best options.
Here is a sample method that returns list of strings :
public static List<string> GetCities()
{
List<string> cities = new List<string>();
cities.Add("Istanbul");
cities.Add("Athens");
cities.Add("Sofia");
return cities;
}
Problem
Can anybody tell me How to store and return List of Strings. I am asked this Because i have written a function which returns Collection of strings and I want to prepare a COM for that one and need to consume that COM(to get the returned list ) in VC++ where I can extend some functionality using that list of strings. I hope this would be clear.