Copy empty string using Clipboard.SetText(string)

c#, clipboard

Solution

If you try to save null or an empty string using `Clipboard.SetText` it will never work.

See Clipboard.SetText Method (String) (MSDN). It mentions ArgumentNullException is thrown if the text is null or `Empty` for `Clipboard.SetText`.

Hence you cannot achieve what you are trying to achieve.

Problem

`Clipboard.SetText("")` throws me an error - "Value cannot be null". So how do I copy an empty string using `Clipboard.SetText`? I have already done `Clipboard.Clear()`. It does clear the clipboard, but it doesn't help me to paste an empty string Any suggestions?

Original source