Is it possible to have multiple methods with the same “core” type signature be overloaded based on the where clause constraints?
For example, ideally I’d like to have these two functions:
class DateWriter {
public void Write<K,V>(string key, Dictionary<K,V> data)
where K : ISerializable
where V : ISerializable { ... }
public void Write<K,V>(string key, Dictionary<K,V> data)
where K : Enum, IConvertible
where V : ISerializable { ... }
}
As is, this results in error CS0111: Type 'DataWriter' already defines a member called 'Write' with the same parameter types
. This indicates it isn’t possible, but I’d like to get either confirmation that it isn’t, or the syntax that would make it work.