I'm implementing a library that parses JSON data into various C# objects using Newtonsoft's LINQ to JSON functions. Apart from the lazy vs. eager approach, is there any impact to passing some other library's IEnumerable vs. dumping it into a List and then returning that? Does this allow better garbage collection or anything along those lines?
public class SimpleClass
{
public IEnumerable<string> Tags { get; private set; }
// Assume the token passed is a valid array of strings.
public void UpdateTags1(JToken token)
{
this.Tags = token["tags"].Values<string>();
}
public void UpdateTags2(JToken token)
{
this.Tags = new List<string>(token["tags"].Values<string>());
}
}