Please, help me to explain the following behavior:
dynamic d = 1;
ISet s = new HashSet();
s.Contains(d);
The
The answers you have received so far do not explain the behaviour you are seeing. The DLR should find the method ICollection and call it with the boxed integer as a parameter, even if the static type of the variable is ISet instead of ICollection (because the former derives from the latter).
Therefore, I believe this is a bug and I have reported it to Microsoft Connect. If it turns out that the behaviour is somehow desirable, they will post a comment to that effect there.