public class candidates
{
public string Name;
public string Dept;
public string ID;
public DateTime Registration;
}
class Program
{
static void Main(string[] args)
{
DateTime fromDate = new DateTime(2017, 7, 31, 9, 30, 0);
DateTime toDate = new DateTime(2017, 7, 31, 11, 00, 0);
List<candidates> _candidate = new List<candidates>();
for (int i = 0; i <= 5; i++)
{
candidates c = new candidates();
c.Dept = "ABC";
c.ID = i.ToString();
c.Name = "Candidate " + i.ToString();
c.Registration = new DateTime(2017, 7, 31, 14-i, 00, 0);
_candidate.Add(c);
}
var _icandidates = from c in _candidate where c.Registration >= fromDate
&& c.Registration <= toDate select c;
}