Is C # Dictionary <string, List <string>>. GetObjectData () (serialization) Is it consistent?
I know that dictionaries do not store their key-value pairs in the order in which they are added, but if I add the same key-value pairs (potentially in different orders) to two different dictionaries and serializing the results, does the data in the file match?
Edit: To clarify, I am asking specifically about the output of GetObjectData (), and not about any particular serializer. Consider the following code:
Dictionary<string,List<string>> dict1 = new Dictionary<string,List<string>>();
Dictionary<string,List<string>> dict2 = new Dictionary<string,List<string>>();
string key11 = "key1";
string key12 = "key1";
string key21 = "key2";
string key22 = "key2";
List<string> values11 = new List(1);
List<string> values12 = new List(1);
List<string> values21 = new List(1);
List<string> values22 = new List(1);
values11.add("value1");
values12.add("value1");
values21.add("value2");
values22.add("value2");
dict1.add(key11, values11);
dict2.add(key22, values22);
dict1.add(key21, values21);
dict2.add(key12, values12);
Will dict1 and dict2 return the same for GetObjectData ()? If not, why not?
+5
3 answers