public ICollection ReadICollection(System.Type collectionType, ES2Type type) { if (settings.encrypt) { return(ReadEncryptedICollection(collectionType, type)); } var result = (IList)ES2Reflection.CreateGenericInstance(collectionType, type.type); reader.ReadByte(); // TODO: Remove this line on the next change to ES2 format. int count = reader.ReadInt32(); for (int i = 0; i < count; i++) { result.Add(Read <object>(type)); } return(result); }
public IDictionary ReadIDictionary(System.Type dictionaryType, ES2Type keyType, ES2Type valueType) { if (settings.encrypt) { return(ReadEncryptedIDictionary(dictionaryType, keyType, valueType)); } var result = (IDictionary)ES2Reflection.CreateGenericInstance(dictionaryType, keyType.type, valueType.type); reader.ReadByte(); // TODO: Remove this line on the next change to ES2 format. reader.ReadByte(); // TODO: Remove this line on the next change to ES2 format. int count = reader.ReadInt32(); for (int i = 0; i < count; i++) { result.Add(Read <System.Object>(keyType), Read <System.Object>(valueType)); } return(result); }