This article example describes how C# gets and displays text content from the windows clipboard. Share it for your reference. The details are as follows:
using System; using ; namespace RobvanderWoude { class Paste { [STAThread] static int Main( string[] args ) { if ( == 0 ) { try { if ( ( ) ) { string clipText = ( ); ( clipText ); return 0; } else { return 1; } } catch ( Exception e ) { ( ); return 2; } } else { ( ); ( ", Version 1.01" ); ( "Read and display text from the clipboard" ); ( ); ( "Usage: PASTE" ); ( ); ( "Note: The program returns the following 'errorlevels':" ); ( " 0 success" ); ( " 1 no text available in clipboard" ); ( " 2 command line or unknown error" ); ( ); ( "Written by Rob van der Woude" ); return 2; } } } }
I hope this article will be helpful to everyone's C# programming.