Survivalcraft API 1.8.2.3 v1.8.2.3
Survivalcraft 2.4
载入中...
搜索中...
未找到
ArraySerializer.cs
浏览该文件的文档.
1namespace Engine.Serialization {
2 public class ArraySerializer<T> {
3 public void Serialize(InputArchive archive, ref T[] value) {
4 List<T> list = new();
5 archive.SerializeCollection(null, list);
6 if (value == null) {
7 value = list.ToArray();
8 return;
9 }
10 if (list.Count != value.Length) {
11 throw new InvalidOperationException("Serializing into an existing array with invalid length.");
12 }
13 list.CopyTo(value);
14 }
15
16 public void Serialize(OutputArchive archive, T[] value) {
17 archive.SerializeCollection(null, null, value);
18 }
19 }
20}
void Serialize(InputArchive archive, ref T[] value)
void Serialize(OutputArchive archive, T[] value)