コード例 #1
0
        public List <GridContent> ReadGridContent()
        {
            List <GridContent> content = new List <GridContent>();

            for (int x = 0; x < 9; x++)
            {
                for (int y = 0; y < 9; y++)
                {
                    GridContent gc = new GridContent(this[x, y]);
                    gc.Position = new GridPosition(x, y);
                    content.Add(gc);
                }
            }

            return(content);
        }
コード例 #2
0
        public override string ToString()
        {
            string str = $"{{GameNr:{GameNr},GameName:{GameName},UserName:{UserName}";

            if (!IsEmpty)
            {
                str += ",gridcontent:[";
                for (int x = 0; x < 9; x++)
                {
                    for (int y = 0; y < 9; y++)
                    {
                        str += new GridContent(this[x, y]).ToString() + ",";
                    }
                }
                str  = str.Substring(0, str.Length - 2); // truncate last comma
                str += "]";
            }
            return(str + "}}");
        }