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
Post a Comment