Skip to content

Instantly share code, notes, and snippets.

@Phuseos
Created May 27, 2016 06:21
Show Gist options
  • Save Phuseos/373efa194dafb5297de14c9969f9e1d2 to your computer and use it in GitHub Desktop.
Save Phuseos/373efa194dafb5297de14c9969f9e1d2 to your computer and use it in GitHub Desktop.
Simple LinQ sample - string aggregation (C#)
protected void btnLINQ_Click(object sender, EventArgs e)
{
string[] WordsToUse = { "Hello ", "World", "!" }; //Array of words to use
var Res = WordsToUse.Aggregate((current, next) => current + next); //Aggregate words using LINQ
System.Web.UI.ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "AlertBox", "alert('" + Res + "');", true); //Print text using JavaScript (don't use in production)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment