var listOfStates = from n in _storageStates
select n.tag;
If n.tag is a string do I need to use the new keyword.
var listOfStates = from n in _storageStates
select new {n.tag};
I would think not since string is a built in type and not a class, but I am not sure.
What you often see is something like:
This creates an anonymous type which is a useful way of grouping multiple values together in a strongly-typed but somewhat ad hoc way. You can do it with a single value like this:
but usually that makes the results harder to work with rather than easier.
Note that anonymous types aren’t restricted to being used in LINQ, although that’s probably where they’re most commonly encountered. Follow the earlier MSDN link for more information.