I am learning to use methods in C# . In this example I am trying to convert Char to String but it is giving me error. I do not understand where I am going wrong.
private void RunScript(object x, object y, ref object A)
{
Print(ReverseString());
}
// <Custom additional code>
private static string ReverseString()
{
string message = "Hello World!";
char[] messageArray = message.ToCharArray();
Array.Reverse(messageArray);
foreach(char item in messageArray)
{
string iString = item.ToString();
return iString;
}
}
This is the error its giving…
Error (CS0161): ‘Script_Instance.ReverseString()’: not all code paths return a value (line 76)
Thanks,