How can I print any object into system clipboard just like printfn "%A" does?
it seems I cannot simply using clipboard.setdataobject().
How can I print any object into system clipboard just like printfn %A does?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use the
spritnffunction, which has the same formatting capabilities asprintfbut returns the formatted string as the result. To store the string in the clipboard once you have it, you can use theSetTextmethod (you’ll need a reference toSystem.Windows.Forms):After running this code, the clipboard should contain a nicely formatted F# list “[1; 2; 3]”.