Your Code Working Fine With me..
I can't find out why, you are not getting the result..
Try different code..I think this will solve your problem.
List<string> dropItems, dropItems2;
using (var dbContext = new DatabaseContext())
{
var data = from o in dbContext.locations select new { o.Code };
foreach (var str in data)
{
if(str!=null)
{
dropItems .Add(str.ToString());
}
}
}
using (var dbContext = new DatabaseContext())
{
var data1 = from o in dbContext.locations select new { o.Name };
foreach (var str1 in data1)
{
if(str1!=null)
{
dropItems2 .Add(str1.ToString());
}
}
}
</string></string></string>