// Serialize / deserialize
        internal void ReadWrite(IReadWriteStream s)
        {
            if (s.IsWriting)
            {
                s.wInt(islandvertices.Count);
                for (int i = 0; i < islandvertices.Count; i++)
                {
                    s.wInt(islandvertices[i]);
                }

                s.wInt(vertices.Count);
                for (int i = 0; i < vertices.Count; i++)
                {
                    s.wVector2D(vertices[i]);
                }

                s.wInt(sidedefs.Count);
                for (int i = 0; i < sidedefs.Count; i++)
                {
                    if (sidedefs[i] != null)
                    {
                        s.wInt(sidedefs[i].SerializedIndex);
                    }
                    else
                    {
                        s.wInt(-1);
                    }
                }
            }
            else
            {
                int c;

                s.rInt(out c);
                int[] islandverticeslist = new int[c];
                for (int i = 0; i < c; i++)
                {
                    s.rInt(out islandverticeslist[i]);
                }
                islandvertices = Array.AsReadOnly(islandverticeslist);

                s.rInt(out c);
                Vector2D[] verticeslist = new Vector2D[c];
                for (int i = 0; i < c; i++)
                {
                    s.rVector2D(out verticeslist[i]);
                }
                vertices = Array.AsReadOnly(verticeslist);

                s.rInt(out c);
                sidedefindices = new int[c];
                for (int i = 0; i < c; i++)
                {
                    s.rInt(out sidedefindices[i]);
                }
            }
        }