I need to use generic methods and non-generic methods in the same interface.
public interface IBRClientActions<T> where T : class { T add(T element); Hashtable add(Hashtable hashtable); void update(T element); void update(Hashtable hashtable); } After I implement this interface in other interface with many type
public interface IBRClientActions : IBRClientActions<AdresseClient>, IBRClientActions<Role>, IBRClientActions<LienClient> { ... } in my final class I need something like that
public class FinalClass : IBRClientActions { AdresseClient add(AdresseClient element) { ... } Hashtable add**<AdresseClient>**(Hashtable hashtable) { ... } .... } But Hashtable add<AdresseClient>(Hashtable hashtable) { ... } is not possible Actually I have ambiguous reference in methods with Hashtable.
How can I have an add method with Hashtable for each type?
Edit 1
Explicit interface implementation
Yes that is a possibility but with this solution I need to cast my class each time
Hashtable htRole = new Hashtable(); FinalClass myClass = new FinalClass(); /* not correct, ambiguity */ myClass.add(htRole); /* correct, no ambiguity but heavy writing (sorry for my bad english) */ ((IBRClientActions<Role>)myClass).add(htRole);