I have a WCF service and I try to send a Dictionary<CustomStruct, int>
from my client to my server. My WCF service use a default BasicHttpBinding.
When I send the Dictionary to the server, no error is thrown. But when I try to loop trough my Dictionary, it is empty.
The weird thing is that Dictionary<string, string>
actually works ?!
Does someone have an idea of why my Dictionary<CustomStruct, int>
is empty after it passes trough the wire and why Dictionary<string, string>
works.
[EDIT] Here's how my struct looks like:
[DataContract]
public struct CustomStruct : IEquatable<CustomStruct>
{
[DataMember]
private string _prop;
public string Prop { get { return _prop; } }
public override int GetHashCode()
{
return Prop.GetHashCode();
}
public static bool operator ==(CustomStruct left, CustomStruct right)
{
...
}
public static bool operator !=(CustomStruct left, CustomStruct right)
{
...
}
public override bool Equals(object obj)
{
...
}
}