I am populating a DropDownList from some Linq query, such as
var myTypes = from tableAlias in MyContext.MyTable ...;
dddTypes.DataSource = myTypes;
I want to be able to save the Linq query result either from myTypes or the DropDownList DataSource, so that it could be used in other methods. A variable of type var can only be local.
What does the data need to be casted to? Thanks.
IEnumerable<MyTable>or you could just convert it to a list withmyTypes.ToList(). The var variable actually is typed by the ling query, so if you add a break point after the query and hover over the myTypes variable, Intellisense will show you the type.