public override fsResult TryDeserialize(fsData data, ref object instance, Type storageType) { var result = fsResult.Success; // Verify that we actually have an List if ((result += CheckType(data, fsDataType.Array)).Failed) { return(result); } fsIEnumerableSerializationAdapter adapter = GetAdapter(storageType); Type elementType = adapter.GetElementType(storageType); var serializedList = data.AsList; for (int i = 0; i < serializedList.Count; ++i) { var serializedItem = serializedList[i]; object deserialized = null; var itemResult = Serializer.TryDeserialize(serializedItem, elementType, ref deserialized); result.AddMessages(itemResult); if (itemResult.Failed) { continue; } adapter.Add(instance, deserialized); } return(result); }
public override fsFailure TryDeserialize(fsData data, ref object instance, Type storageType) { fsIEnumerableSerializationAdapter adapter = GetAdapter(storageType); Type elementType = adapter.GetElementType(storageType); var serializedList = data.AsList; for (int i = 0; i < serializedList.Count; ++i) { var serializedItem = serializedList[i]; object deserialized = null; var fail = Serializer.TryDeserialize(serializedItem, elementType, ref deserialized); if (fail.Failed) { return(fail); } adapter.Add(instance, deserialized); } return(fsFailure.Success); }