asp.net mvc - error saying system.void cannot be used from c# -


i have interface

using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; using guestbook.models;  namespace guestbook.controllers {     public interface iguestbookrepository     {         ilist<guestbookentry> getmostrecententries();         guestbookentry findbyid(int id);         ilist<commentsummary> getcommentsummary();         void addentry(guestbookentry entry);     } } 

and implementation class looks this

using system; using system.collections.generic; using system.linq; using guestbook.models;  namespace guestbook.controllers { public class guestbookrepository : iguestbookrepository {     private readonly guestbookcontext _db = new guestbookcontext();       public void addentry(guestbookentry entry)      {         entry.dateadded = datetime.now;          _db.entries.add(entry);         _db.savechanges();      } } 

when type compile error saying system.void cannot used c# -- use typeof(void) void type object.

what wrong i'm doing? can me maybe?

this problem, in interface declaration:

void addentry(guestbookentry entry); 

it should be:

void addentry(guestbookentry entry); 

the first version refers system.void type, can't used within c# (as per error message). second c# way of writing method no return value.


Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -