title: How to make a Generic Collection with Type Constraint that implement two interfaces?
body: <p>excuse me I havent dealt much with generic in c# </p>
  
  <p><a href="https://stackoverflow.com/questions/772053/is-it-possible-to-make-a-parameter-implement-two-interfaces">according to this question</a> ,how is it possible to make a generc collection
  that implement two interfaces
  i was looking for a direct way like this:<strong><em>of course it makes error and totally is wrong.</em></strong></p>
  
  <pre><code>interface IEmployee {void DisplayInfo();}
  
  interface ISalary {void CalculateSalary();}
  
  
  class Nurse : IEmployee, ISalary
  {
   //some Implementation
  }
  
  
  class Doctor : IEmployee, ISalary
  {
   //some Implementation
  }
  
  class EntryPoint
  {
   static void Main(string[] args)
    { 
    System.Collections.Generic .List&lt;T&gt;  employees where T: ISalary,IEmployee
     =new System.Collections.Generic .List&lt;T&gt;();
    }
  
   Nurse oNurse = new Nurse();
   Doctor oDoctor = new Doctor();
  
   employees.Add(oNurse);
   employees.Add(oDoctor);
  }
  </code></pre>
  
  <p>after some Reading i found that maybe i must define a generic class like this at first:</p>
  
  <pre><code>public class HospitalEmployee&lt;T&gt; where T : IEmployee, ISalary
  </code></pre>
  
  <p>{</p>
  
  <p>}</p>
  
  <p>and unfortunately it dosnt work ,Now I am confused and dont know what must to do exactly,please help,thank u</p>