c# - Unreachable Code Detected Return Value -


how return value issue? me please.

protected string sendstate(object id_dip,object id_seq,object modul) {     try     {         viewstate["ssdip"] = id_dip.tostring();         viewstate["ssseq"] = id_seq.tostring();         viewstate["ssmod"] = modul.tostring();          return id_dip.asstring();         return id_seq.asstring();         return modul.tostring();     }     catch (exception)     {         return "";     } } 

first thing u have multiple return values, ur code wouldn't work, u can use list<string> & return in catch case, u use var @ top of method definition, this--->

public list<string> sendstate(object id_dip,object id_seq,object modul) {      var returnvalue = new list<string>();           try           {                 viewstate["ssdip"] = id_dip.tostring();                 viewstate["ssseq"] = id_seq.tostring();                 viewstate["ssmod"] = modul.tostring();                   returnvalue.add(id_dip.asstring());                 returnvalue.add(id_dip.asstring());                 returnvalue.add(modul.tostring());            }           catch (exception)           {                 returnvalue = null;           }      return returnvalue; } 

now u can use above method this--->

var result = sendstate( params )  //<--- params r ur parameters if(result != null)     // proceed else     // no value found 

Comments

Popular posts from this blog

php - mySql Join with 4 tables -

css - Text drops down with smaller window -

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