title: C# Parameters for Returning a Private Variable From a Public Method
body: <p>Whereas in VB standard programming practice with classes is to set a private variable directly and only access it through a public method to return it's value this doesn't seem to work. Or maybe my issue is in how I handle parameters and arguments.</p>
  
  <p>I would extremely appreciate someone could resolve this issue.</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  
  namespace Program
  {
  class Program
  {
  
      private string name;
  
      static void Main(string[] args)
      {
          SetName();
          Console.WriteLine("Name: " &amp; ReturnName());
      }
      private static void SetName()
      {
          Console.WriteLine("What is your name?");
          string name = Console.ReadLine();
      }
      public static string ReturnName(string name)
      {
          return name;
      }
  }
  }
  </code></pre>
  
  <p>Errors:</p>
  
  <p><a href="https://i.stack.imgur.com/Kt9d7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Kt9d7.png" alt="Screenshot of Problem"></a></p>