title: Comparing string lengths in C#
body: <p>I need to make function that determine longer word of two entered. I have tried to use if-statement and <code>String.Length</code>, but I can't get it right. What would be the best way to make the function?
  Below is the main program.</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  
  public class LongerWord
  {
      public static void Main(string[] args) 
      {
          Console.Write("Give 1. word &gt;");
          String word1 = Console.ReadLine();
          Console.Write("Give 2. word &gt;");
          String word2 = Console.ReadLine();
          String longer = LongerString(word1, word2);
          Console.WriteLine("\"" + longer + "\" is longer word");
          Console.ReadKey();
      }
  }
  </code></pre>