---
title: "Unreachable Code Detected Return Value"  
description: "Unreachable Code Detected Return Value"  
author: "Anonymous User"  
published: 2013-05-15  
updated: 2013-05-15  
canonical: https://www.mindstick.com/forum/885/unreachable-code-detected-return-value  
category: "c#"  
tags: ["c#"]  
reading_time: 2 minutes  

---

# Unreachable Code Detected Return Value

Hi Guys\
How to [return value](https://www.mindstick.com/forum/33675/how-to-convert-return-value-of-abmulivaluecopylabelatindex-into-nsstring-in-ios) with this issue? Help 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 "";    }}
```

\
Thanks

## Replies

### Reply by AVADHESH PATEL

Hi Pravesh!\
You have multiple return statements, your code will not execute statements after first return statement. You can't return multiple values from your method, if you want to return multiple values you can either return List<string> for your case or create a temporary class and return its object.\
In your code you are using AsString, I think you probably meant ToString\
Define a class like:\
public class MyReturnObject{ public string ID_DIP { get; set; } public string ID_SEQ { get; set; } public string MODUL { get; set; }}\
Modify your method like:\
protected MyReturnObject SendState(Object ID_DIP, Object ID_SEQ, Object MODUL){ try { ViewState["ssDIP"] = ID_DIP.ToString(); ViewState["ssSEQ"] = ID_SEQ.ToString(); ViewState["ssMOD"] = MODUL.ToString();\
MyReturnObject obj = new MyReturnObject(); obj.ID_DIP = ID_DIP.ToString(); obj.ID_SEQ = ID_SEQ.ToString(); obj.MODUL = MODUL.ToString(); return obj; } catch (Exception) { return null; }}


---

Original Source: https://www.mindstick.com/forum/885/unreachable-code-detected-return-value

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
