/// <summary> /// http://www.dotnetperls.com/linq /// </summary> public partial class LinqForm : Form { const int _max = 1000000; /// <summary> /// Linq keyword /// </summary> public enum CheckLinq { Distinct, Union, Intersect, Except, Var, Loop, New, Orderby, Group, Join, Let, Where, ToDictionary, Lambda, GroupJoin, GroupBy } /// <summary> /// /// </summary> /// <returns></returns> DataTable setcom() { DataTable dt = new DataTable(); dt.Columns.Add("id", typeof(int)); dt.Columns.Add("name", typeof(string)); dt.Rows.Add(1, "Distinct"); dt.Rows.Add(2, "Union"); dt.Rows.Add(3, "Intersect"); dt.Rows.Add(4, "Except"); dt.Rows.Add(5, "Var"); dt.Rows.Add(6, "Loop"); dt.Rows.Add(7, "New"); dt.Rows.Add(8, "Orderby"); dt.Rows.Add(9, "Group"); dt.Rows.Add(10, "Join"); dt.Rows.Add(11, "Let"); dt.Rows.Add(12, "Where"); dt.Rows.Add(13, "ToDictionary"); dt.Rows.Add(14, "Lambda"); dt.Rows.Add(15, "GroupJoin"); dt.Rows.Add(16, "GroupBy"); return dt; } /// <summary> /// /// </summary> public LinqForm() { InitializeComponent(); } /// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void LinqForm_Load(object sender, EventArgs e) { this.comboBox1.DataSource = setcom(); this.comboBox1.ValueMember = "id"; this.comboBox1.DisplayMember = "name"; } /// <summary> /// /// </summary> public string TestSetSemantics(CheckLinq check) { List<string> lstColumn = new List<string>(); List<string> strDistinct = new List<string>(); List<string> strUnion = new List<string>(); List<string> strExcept = new List<string>(); List<string> strIntersect = new List<string>(); List<string> strVar = new List<string>(); List<string> strLoop = new List<string>(); List<string> strNew = new List<string>(); List<string> strOrderby = new List<string>(); List<string> strGroup = new List<string>(); List<string> strJoin = new List<string>(); List<string> strLet = new List<string>(); List<string> strWhere = new List<string>(); List<string> strToDictionary = new List<string>(); List<string> strLambda = new List<string>(); List<string> strGroupJoin = new List<string>(); List<string> strGroupBy = new List<string>(); string str = string.Empty; string[] dailySecurityLog = { "Bob logged in", "Bob logged out", "Bob logged in", "Bill logged in", "Melissa logged in", "Bob logged out", "Bill logged out", "Bill logged in", "Tim logged in", "Scott logged in", "Scott logged out",