title: Task to replace first and last character of two strings
body: <p>I am doing exercise which provides solutions too however, no explanation on the code in the solution is given and cannot understand the code. Hope I can get help in understanding it </p>
  
  <p><strong>Exercise:</strong>
  Write a C# program to create a new string from a given string where the first and last characters will change their positions.</p>
  
  <p><strong>Strings:</strong>
  w3resource
  Python</p>
  
  <p><strong>Expected output:</strong>
  e3resourcw
  nythoP</p>
  
  <p><strong>Solution:</strong></p>
  
  <pre><code>public class Exercise16 {
    static void Main(string[] args)
          {
              Console.WriteLine(first_last("w3resource"));
              Console.WriteLine(first_last("Python"));
              Console.WriteLine(first_last("x"));
          }
         public static string first_last(string ustr)
          {
            // code that I don't understand
             return ustr.Length &gt; 1
             ? ustr.Substring(ustr.Length - 1) + ustr.Substring(1, ustr.Length - 2) + ustr.Substring(0, 1) : ustr;
              }
      }
  </code></pre>
  
  <p>P.S - I am beginner in C# but not in programming overall</p>