Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

trying to grasp Lambda usage - can I run this function from a Lambda (simple winform Test app) ?

$
0
0

I am trying to grasp Lambda usage and put together a very simple winform test app that copies the content of one textbox to another textbox and adds a little bit of additional text from a button click event. Here is a picture of what I am doing and the code below that. The question is if this could be done with a Lambda and what would that look like? Or -- if my test app does not lend itself for Lambda usage could someone suggest a simplistic scenario like mine where a Lambda could be used?

Here is the code behind

using System;
using System.Linq;
using System.Windows.Forms;

namespace testThing1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            textBox2.Text = Thing1.ReadThing(textBox1.Text);
        }
    }

    class Thing1
    {
        public static string ReadThing(string txt)
        {
            return txt + " -- return Thing";
        }
    }
}

Thanks


Rich P


Viewing all articles
Browse latest Browse all 31927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>