I’m just reading some LINQ for dummies stuff and I got a question. Here is the code:
private void btnTest_Click(object sender, EventArgs e)
{
// Create an array as a data source.
String[] QueryString = { “One”, “Two”, “Three”, “Four”, “Five” };
// Define the query.
var ThisQuery = from StringValue in QueryString
where StringValue.Length > 3
select StringValue + “\r\n”;
// Display the result.
foreach (var ThisValue in ThisQuery)
txtResult.Text = txtResult.Text + ThisValue;
}
What is txtResult, will it work without a declaration?
txtresult is the value of Name Property of used TextBox control in this code. You need to add a TextBox in your application and assign it Name property value ‘txtresult’ for this code to work.