使用Clipboard.SetText(string)复制空字符串 [英] Copy empty string using Clipboard.SetText(string)
问题描述
Clipboard.SetText()
抛出错误-值不能为空。那么如何使用 Clipboard.SetText
复制空字符串?
Clipboard.SetText("")
throws me an error - "Value cannot be null". So how do I copy an empty string using Clipboard.SetText
?
我已经完成了 Clipboard.Clear()
。它确实清除了剪贴板,但是粘贴空字符串
I have already done Clipboard.Clear()
. It does clear the clipboard, but it doesn't help me to paste an empty string
有任何建议吗?
推荐答案
如果尝试使用 Clipboard.SetText
保存null或空字符串,则它将永远无法工作。
If you try to save null or an empty string using Clipboard.SetText
it will never work.
请参见 Clipboard.SetText方法(字符串) (MSDN)。它提到如果文本为null或 Clipboard.SetText
的 Empty
,则抛出ArgumentNullException。
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.
这篇关于使用Clipboard.SetText(string)复制空字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!