hamid khan

hamid khan

  • NA
  • 4
  • 35.7k

Compiler Error Message: CS0161: '_Default.parseValue(string, string, string, bool)': not all code paths return a value

Sep 17 2010 9:10 AM
hi guys i am getting the above error in my code - below

pleas help me what is wrong in this code as i am a beginner in csharp programming

thanks in advance

public string parseValue(String responseBody, String prefix, String posix, bool include1)
    {
        String action;
        int i;

        //try to find the first type

        i = responseBody.IndexOf(prefix);
        if (i >= 0)
        {
            if (include1)
            {

                action = responseBody.Substring(i);

            }

            else
            {

                action = responseBody.Substring(i + prefix.Length);

            }
            if (!posix.Equals(""))
            {
                action = action.Substring(0, action.IndexOf(posix));
                return action.Trim();

            }
            throw new Exception("Value '" + prefix + "' not found");

        }
    }

Answers (1)