Title: Convert from console to string for return
Tags: c#;excel
Question: I am attempting to convert my output from the console to a return type of string, what am I missing? Under return I get an error that says, "returns void, a return keyword must not be followed by an object expression." And when I take the return off, it gives me the same thing for the string sInput. 

```    static void Main(string[] args)
    {
        var excel = new Application();
        Workbook workbook = excel.Workbooks.Open(@"C:\Documents\Mail.xlsx");
        Worksheet worksheet = workbook.Worksheets[1];

        var MailNumbers = worksheet.UsedRange;
        string sInput;

        foreach (Range row in MailNumbers.Rows)
        {
           sInput = row.Cells[2, 8].Text + " " + row.Cells[2, 4].Text + " " + row.Cells[2, 5].Text + " " + row.Cells[2, 6].Text + " " + row.Cells[2, 3].Text + " " + row.Cells[2, 7].Text;    
        };
        return sInput;
        excel.Quit();  
    }
```

Hopefully Im overlooking something simple. 
Thanks!

Comment: You mean other than ignoring the fact that `main` is documented (and declared in your code) as `void`, which means it can't possibly return a value?

Comment: I tried to change void to string. And I got an error under Main, "Not all code paths return a value."



{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 0, 'CommentCount': 2, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2015:00:10/20/15', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<c#><excel>', 'Title': 'Convert from console to string for return', 'ViewCount': 28, 'id': 33242198, 'user_AboutMe': None, 'user_AccountId': 7047125.0, 'user_DisplayName': 'MrASifuMason', 'user_Reputation': 21.0, 'user_Views': 7.0, 'user_id': 5397601.0}}