Saturday 3 March 2012

C# - How to Fix Error - Non-invocable member 'System.DateTime.Now' cannot be used like a method.



to fix error
Non-invocable member 'System.DateTime.Now' cannot be used like a method.   
remove ()




    using (SchoolEntities schoolContext = new SchoolEntities())
            {
                var res = from c in schoolContext.Course
                          select new
                          {
                              // Started = c.Department.StartDate > DateTime.Now() //this will produce error
                              Started = c.Department.StartDate > DateTime.Now // this is OK
                          };


            }

No comments:

Post a Comment