That code won't even compile, much less paste empty data.
private string ClipboardData
{
get
{
IDataObject iData = Clipboard.GetDataObject();
if (iData == null) return '';
if (iData.GetDataPresent(DataFormats.Text))
return (string)iData.GetData(DataFormats.Text);
return '';
}
set { Clipboard.SetDataObject(value); }
}
Will give you an error on both of your
return ''
statements because you can't have an "empty character literal": ''
Even if you fix that, you can't return a
char
value from a string property - that will give you an error as well, probably a type conversion message.
Almost certainly, you should be returning an empty string "" instead, though a
null
might be a better choice.
So the code you are testing isn't the code you are showing - which means that the tests you are doing are on the last version of your code that did compile, and that is probably why it doesn't work the way you think it should.
Fix that, and try again - and use the debugger to find out exactly what is going on!