Battlefield.Logic.Fields.Field.ToString C# (CSharp) Метод

ToString() публичный Метод

ToString overriding.
public ToString ( ) : string
Результат string
        public override string ToString()
        {
            var playField = new StringBuilder();
            playField.Append("  ");

            // horizontal indexing
            for (var col = 0; col < this.Size; col++)
            {
                playField.AppendFormat(" {0}", (char)(col + 'A'));
            }

            playField.AppendLine();

            // horizontal split
            playField.Append("  ".PadRight((this.Size + 1) * 2, '-'));
            playField.AppendLine();

            for (var row = 0; row < this.Size; row++)
            {
                // vertical indexing and splitting
                if (row < 9)
                {
                    playField.AppendFormat("{0}".PadLeft(4, ' ') + "|", row + 1);
                }
                else
                {
                    playField.AppendFormat("{0}|", row + 1);
                }

                // the field itself
                for (var col = 0; col < this.Size; col++)
                {
                    char symbol;
                    switch (this.Grid[row, col].Value)
                    {
                        case EmptyCell:
                            symbol = '-';
                            break;
                        case DetonatedCell:
                            symbol = 'x';
                            break;
                        default: symbol = '-';
                            break;
                            //// default:
                            //    symbol = (char)('0' + this.Grid[row, col].Value);
                            //    break;
                    }

                    playField.AppendFormat("{0} ", symbol);
                }

                playField.AppendLine();
            }

            return playField.ToString();
        }