title: Interface with different types
body: <p>I have a problem where I have two implemention that I want to share a interface, but they will have different types for "the same parameter", see one <code>Guid</code> and one <code>Int</code>.</p>
  
  <p>For example:</p>
  
  <pre><code>public Class1 : IGetObject {
     GetObjectBy(int Id);
  }
  
  public Class2 : IGetObject {
     GetObjectBy(Guid Id);
  }
  </code></pre>
  
  <p>At the other end of the application the "Id" argument will come from a user input which is string. So I also have</p>
  
  <pre><code>public GetObjectMethod(){
    string id = dropdown.SelectedItem.Text;
    IGetObject GetObject = Shared.Instance.GetObject;
    var result = GetObject.GetObjectBy(id);
  }
  </code></pre>
  
  <p>How can I make the implemention share the interface so I don't have to change something in the GetObjectMethod?</p>
  
  <p>What I think is maybe an idea is to create a new <strong>type</strong> like this and declare that in the common interface. In that way the implemention know which propery it should use:</p>
  
  <pre><code>public class ObjectId(){
     public ObjectId(string id){
        if(Guid.TryParse(id)){
         /// Figure out what value that should be set
        }
     }
  
     public Guid ObjectIdAsGuid;
     public Int  ObjectIdAsInt;
  }
  </code></pre>
  
  <p>What is the best way of doing it?</p>