/// <summary> /// Writes character attributes to the screen buffer at the given cursor position. /// </summary> /// <param name="attrs">An array of attributes to be written to the screen buffer.</param> /// <param name="nattrs">The number of attributes to be written.</param> /// <param name="x">Column position in which to write the first attribute.</param> /// <param name="y">Row position in which to write the first attribute.</param> /// <returns>Returns the number of attributes written.</returns> public int WriteAttributesXY(ConsoleCharAttribute[] attrs, int nattrs, int x, int y) { if (disposed) { throw new ObjectDisposedException(this.ToString()); } if (nattrs > attrs.Length) { throw new ArgumentException("nattrs cannot be larger than the array length"); } int attrsWritten = 0; Coord writePos = new Coord((short)x, (short)y); if (!WinCon.WriteConsoleOutputAttribute(_handle, attrs, attrs.Length, writePos, ref attrsWritten)) { throw new System.IO.IOException("Write error", Marshal.GetLastWin32Error()); } return(attrsWritten); }