private void RestoreFromData() { byte[] bytes = Convert.FromBase64String(data); MemoryStream input = new MemoryStream(bytes); using (DeflateStream stream = new DeflateStream(input, CompressionMode.Decompress)) { int arrayLength = stream.ReadInt(); array = new int[arrayLength]; Count = 0; for (int i = 0; i < arrayLength; ++i) { array[i] = stream.ReadInt(); if (array[i] != 0) { ++Count; } } } }