Ejemplo n.º 1
0
        private void Retrieve_Click(object sender, EventArgs e)
        {
            //declare the action here
            Action <RichTextBox, string> RetrieveWithoutError;

            //define the action,  = method body
            RetrieveWithoutError = delegate(RichTextBox GC, string FC)
            {
                try
                {
                    GC.AppendText(File.ReadAllText(".\\GraficConsole.txt"));
                }
                catch (Exception)
                {
                    using (StreamWriter w = File.AppendText(FC))
                    {
                        ;
                    }
                }
            };

            GraficConsole.AppendText(Environment.NewLine + "using the Retrive Action here ..." + Environment.NewLine);
            //call the action here
            RetrieveWithoutError(GraficConsole, AppFiles.ConsoleTextFile.TheFileComplete);
        }