Error - invalid token '(' in class struct or interface member declaration in c# -


my code -

public partial class app : application {      harvestapp.googleapimanager gapimanager = new harvestapp.googleapimanager();      list<event>todaycalendar = gapimanager.getcalendareventsfordate(datetime.today);      harvestapp.harvestmanager hapimanager = new harvestapp.harvestmanager();      console.writeline("entries found today :" + todaycalendar.count);      foreach(event todayevent in todaycalendar)     {         var addevent = new harvestapp.harvest_timesheetentry(todayevent);         entrylist.add(addevent);         hapimanager.postharvestentry(addevent);     }   } 

it gives me token error. please help.

the problem did put code directly in class , not inside member constructor:

public partial class app : application {     public app()     {         harvestapp.googleapimanager gapimanager = new harvestapp.googleapimanager();          list<event>todaycalendar = gapimanager.getcalendareventsfordate(datetime.today);          harvestapp.harvestmanager hapimanager = new harvestapp.harvestmanager();          console.writeline("entries found today :" + todaycalendar.count);          foreach(event todayevent in todaycalendar)         {             var addevent = new harvestapp.harvest_timesheetentry(todayevent);             entrylist.add(addevent);             hapimanager.postharvestentry(addevent);         }     }  } 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -