The clipboard has a protocol, a mutually agreed way to get data from one process to another. Such a protocol should have limited ability to put reasonable data on the clipboard. You can put whatever you want on the clipboard, especially the .NET object. But if another application pasting data into the clipboard does not understand .NET objects, it is very likely that if it was not written in .NET, then it will simply exclaim WTF.
Thus, the method you use is just a helper method of the Clipboard class, which puts data on the clipboard using the standard protocol. That another application can understand, but does not guarantee. The protocol is DataFormats.FileDrop.
The planned replacement will also be very good, you can, of course, put the line on the clipboard. The most basic thing you would ever like to copy / paste. But the application that inserts it only recognizes it as a string. He has no idea that a string should mean something else. The protocol is DataFormats.Text.
The solution is very simple, just write a little private helper method that takes a string. And uses Directory.GetFiles () to create a StringCollection that you put on the clipboard. Simple, mission accomplished, kiss.
source share