Returning the new string in the method
<p>I'm newbie to c#, So i tried the below program, which will change the case of the first character of the string</p>

<pre><code>public class StringBuilder
    {
        public static string ChangeFirstLetterCase(string inputdata)
        {
            if(inputdata.Length &gt; 0)
            {
                char[] charArray = inputdata.ToCharArray();
                charArray[0] = char.IsUpper(charArray[0]) ? 
                    char.ToLower(charArray[0]) : char.ToUpper(charArray[0]);
                //return new string(charArray);
                return charArray.ToString();
            }
            return inputdata;
        }
    }
class Program
    {
        static void Main(string[] args)
        {
            var a = StringBuilder.ChangeFirstLetterCase("vishnu");
            Console.WriteLine(a);
            Console.ReadLine();
        }
    }
</code></pre>

<p>Since the return type of this method <code>ChangeFirstLetterCase()</code> is a string. So I'm just doing the conversion like below</p>

<pre><code>`return charArray.ToString();`
</code></pre>

<p>So in the method call it is returning the <code>System.Char[]</code></p>

<p>Alternatively I tried the below one as well</p>

<pre><code>`return new string(charArray);`
</code></pre>

<p>So this is returning the value as expected</p>

<pre><code>Argument to the method - "vishnu"
Return value - "Vishnu"
</code></pre>

<p>So my question here is</p>

<ol>
<li><p>Since the return type of the method is string, what's wrong with below conversion?</p>

<p><code>return charArray.ToString();</code></p></li>
<li><p>How do we know when to return as new string?.</p>

<p><code>return new string(charArray);</code></p></li>
</ol>

<p>Please provide me some example</p>