LINQ in not only for Object Query
Here we will explore another side of LINQ (Language-INtegrated Query). We all know that LINQ is to query the object (even to the System object). Using the System.Reflection namespace we can get the list of Methods, Fields etc using LINQ Query (with the filter and sort). Lets see one small example on that,
IEnumerable<Type> all = from t in typeof(SqlConnection).Assembly.GetTypes()
where t.Name == "SqlConnection"
foreach(var v in all)
textBox1.Text += "Start:Methods of " + v.Name + "\r\n";
textBox1.Text += "===================================\r\n";
foreach(MemberInfo mi in v.GetMembers())
textBox1.Text += mi.Name + "\r\n";
The output will display the list of methods from the SqlConnection class.