Class ClipboardHelper
- Namespace
- SunamoClipboard
- Assembly
- SunamoClipboard.dll
Provides helper methods for working with the system clipboard.
public static class ClipboardHelper
- Inheritance
-
ClipboardHelper
- Inherited Members
Methods
AppendText(string)
Appends text to the existing clipboard content with two newlines as separator.
public static void AppendText(string textToAppend)
Parameters
textToAppendstringThe text to append to the clipboard.
GetLines()
Gets lines from the clipboard by splitting on newline characters.
public static List<string> GetLines()
Returns
GetLinesAllWhitespaces()
Gets lines from the clipboard by splitting on all whitespace characters.
public static List<string> GetLinesAllWhitespaces()
Returns
GetText()
Gets text from the clipboard.
public static string GetText()
Returns
- string
The text from the clipboard, or an empty string if the clipboard is empty or null.
SetDictionary<T1, T2>(Dictionary<T1, T2>, string)
Sets a dictionary to the clipboard, with each key-value pair on a separate line.
public static void SetDictionary<T1, T2>(Dictionary<T1, T2> dictionary, string delimiter) where T1 : notnull where T2 : notnull
Parameters
dictionaryDictionary<T1, T2>The dictionary to set to the clipboard.
delimiterstringThe delimiter to use between keys and values.
Type Parameters
T1The type of the dictionary keys.
T2The type of the dictionary values.
SetLines(List<string>)
Sets multiple lines to the clipboard, joined by newline characters.
public static void SetLines(List<string> list)
Parameters
SetText(string)
Sets text to the clipboard. Cannot be empty or only whitespace - if the text is empty, the clipboard content will remain unchanged.
public static void SetText(string text)
Parameters
textstringThe text to set to the clipboard.
SetText(StringBuilder)
Sets text from a StringBuilder to the clipboard.
public static void SetText(StringBuilder stringBuilder)
Parameters
stringBuilderStringBuilderThe StringBuilder containing the text to set to the clipboard.