Using system; using system. collections. generic; using system. LINQ; using system. text; using system. diagnostics; using system. io; namespace lambdaexpressionaction {class program {static void main (string [] ARGs) {// action: Generic delegate, you can capture a behavior as an callable object. // you only need to provide the parameter type for the action and assign it a Lambda expression. // you can define the delegate of an output string, S is the output string, and textwriter is an output instance, such as console action <string, textwriter> output delegate = (S, writer) => writer. writeline (s); // set" Console "string outputs the delegate in the console (" console displays the output string! ", Console. out); // define an output stream to write the string to the last row of the "C: \ temp \ text.txt" text file streamwriter stream = file. appendtext ("C: \ temp \ text.txt"); // if the user expects immediate feedback from the device you write, set autoflush to true stream. autoflush = true; // call the output delegate ("system. the output string is displayed in Io! ", Stream); console. Readline ();}}}