Class Clipboard
Provides cut, copy, and paste support for the OS clipboard.
public static class Clipboard
- Inheritance
-
Clipboard
- Inherited Members
Remarks
On Windows, the Clipboard class uses the Windows Clipboard APIs via P/Invoke.
On Linux, when not running under Windows Subsystem for Linux (WSL), the Clipboard class uses the xclip command line tool. If xclip is not installed, the clipboard will not work.
On Linux, when running under Windows Subsystem for Linux (WSL), the Clipboard class launches Windows' powershell.exe via WSL interop and uses the "Set-Clipboard" and "Get-Clipboard" Powershell CmdLets.
On the Mac, the Clipboard class uses the MacO OS X pbcopy and pbpaste command line tools and the Mac clipboard APIs vai P/Invoke.
Properties
- Contents
Gets (copies from) or sets (pastes to) the contents of the OS clipboard.
- IsSupported
Returns true if the environmental dependencies are in place to interact with the OS clipboard.
Methods
- TryGetClipboardData(out string)
Copies the _contents of the OS clipboard to
result
if possible.
- TrySetClipboardData(string)
Pastes the
text
to the OS clipboard if possible.