.net - Constructor cannot call itself c# -


constructor "delay.vkmessages.vkmessages(string, system.datetime, string, bool, string)" cannot call itself.i have class, copy of class, works(i can add code).how can resolve error?

   using system;     using system.collections.generic;     using system.componentmodel;     using imagecacher;      namespace delay     {     public class vkmessages : inotifypropertychanged     {         public string kto { get; private set; }         public datetime date_time { get; private set; }         public string inorout { get; private set; }         public string text { get; private set; }         public bool read_state { get; private set; }         public ienumerable<vkmessages> messages         {                         {                 if (null == _vk_messages)                 {                     _vk_messages = messageservice.getmessages(inorout, () => messagesloaded = true);                 }                 return _vk_messages;             }         }         private ienumerable<vkmessages> _vk_messages;         public bool messagesloaded         {             { return _messagesloaded; }             set             {                 _messagesloaded = value;                 invokepropertychanged("messagesloaded");             }         }         private bool _messagesloaded;          public vkmessages(string kto, datetime date_time, string text, bool read_state)         {             kto = kto;             date_time = date_time;             text = text;             read_state = read_state;          }         public vkmessages(string kto, datetime date_time,             string text, bool read_state,string in_or_out)              : this(kto,date_time,text,read_state,in_or_out)         {             inorout = in_or_out;          }.... 

remove last parameter:

public vkmessages(string kto, datetime date_time,                   string text, bool read_state,string in_or_out)     : this(kto, date_time, text, read_state) {     inorout = in_or_out; } 

that said, logic skewed, should other way round (i.e. constructor should work , other constructor should call one:

public vkmessages(string kto, datetime date_time, string text, bool read_state)     : this(kto, date_time, text, read_state, false) { }  public vkmessages(string kto, datetime date_time,                   string text, bool read_state,string in_or_out) {     inorout = in_or_out;     kto = kto;     date_time = date_time;     text = text;     read_state = read_state;  } 

finally, should fix identifiers conform .net guidelines. in particular, class should follow pascalcase convention of starting upper-case letter.


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -