Alright so here's this class.
class Object
{
// variables here
}
I want to be able to copy an instance of this class to the clipboard and then be able to access it. I'm pretty sure this is possible but I'm unsure on how to go about it. And of course how would I access the data? How would I check if this object is in the clipboard or not? Thanks for the help guys.
the clip board only really holds raw data it ins't capable of holding an object. your two options are serializing the object and passing the byte sting to the clipboard and reconstruct it on the other side. or, if your copy pasting within the same program instance as I amuse you are, you can pass to the clip board some identifying information that can point the other side to the where the object you need to access is in the program. and then use that information to access it.
you can extend the clipboard to hold different types of objects.
really?
hmm perhaps this will help G_G it seems my knolege of what the clipboard can do is wrong.
http://weblogs.asp.net/andrewrea/archive/2008/02/18/add-object-to-clipboard-using-c-in-a-couple-of-ways.aspx (http://weblogs.asp.net/andrewrea/archive/2008/02/18/add-object-to-clipboard-using-c-in-a-couple-of-ways.aspx)
Yup. I got it thanks guys. I also found this. Just the simplest way to do it I think.
http://blog.csharphelper.com/2010/05/13/copy-and-paste-objects-to-the-clipboard-in-c.aspx
I did the same thing in Blizz-ABS Config, I was going to tell winkio to post that piece of code, but you already figured it out as I can see. xD
BTW, I like creating an actual identical copy using serialization.
Well see since its my own class I created my own clone method so isn't that pretty identical?
The thing with cloning using serialization is that it can be done in 3 lines of code. Even if your class has over 9000 variables, you just need those 3 lines for cloning.