title: c# property get,set with different types
body: <p>I have such an enum and a property.    </p>
  
  <pre><code>        public enum Type
          {
              Hourly = 1,
              Salary = 2,
              None = 3
          };
  
  
          public string EmployeeType
          {
              get
              {
                  string type;
                  switch (employeeType)
                  {
                      case Type.Hourly:
                          type = "Hourly Employee";
                          break;
                      case Type.Salary:
                          type = "Salary Employee";
                          break;
                      default:
                          type = "None";
                          break;
                  }
                  return type;
              }
  
              // **EDIT:**
              // Now I am trying to parse the string as enum Type.
              // But Constructor still waits a string to set EmployeeType.
              set
              {
                  employeeType = (Type)Enum.Parse(typeof(Type), value);
              }
          }
  </code></pre>
  
  <p>This is my class:</p>
  
  <pre><code>public class Employee
  {
       private Type employeeType;
  }
  </code></pre>
  
  <p>And I want to create such a constructor:</p>
  
  <pre><code>Employee(Employee.Type type) 
  {
        EmployeeType = type;
  }
  </code></pre>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Cannot implicitly convert type 'Payroll.Employee.Type' to 'string'</p>
  
  <p>How should I write the set accessor of the property?</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>I wanted the get accessor to return string and set accessor to take parameter type Employee.Type. I learned that it is impossible to do this in a property according to the C# spec. I have to write separate getter and setter methods.</p>