I implemented a simple class with one method that takes a Dictionary argument as follows.
public class Program
{
static public Dictionary<string, object> ReadDictionary(Dictionary<string, object> dictionary)
{
return dictionary;
}
}
My problem is that, if I pass a dictionary with mixed values including a Point like in the screenshot below, I will receive a “Warning: Object must implement IConvertible”, and the output dictionary does not include the point. Indeed, when I debugged the code and put a breakpoint on the line “return dictionary”, I can see that the input dictionary only contains 2 elements with keys “foo” and “bar”. What is my mistake here?
Many thanks Erik, that worked.
For the record, the IDictionary class in your code comes from System.Collections, instead of System.Collections.Generic.