Finally, we now know enough to start talking about LINQ, which is an acronym for Language Integrated Query which is basically just a fancy way of doing queries and SQL-like things in C#. If you don’t know what SQL is, you should probably research about it a bit first, but, at a macro level, SQL (Structured Query Language) is just a language for interacting with databases.… Read more
Posts Tagged ‘lambda expression’
LINQ
Monday, May 24th, 2021Closures
Sunday, February 2nd, 2020Let’s consider the following Action:
using System;
namespace HelloWorld
{
public class Program
{
public static void Main()
{
int i = 0;
Action a = () => i++;
a();
a();
a();
Console.WriteLine(i);
Console.Read();
}
}
}
From the lesson Func and Action, you remember that an Action is just a delegate that returns void and takes between 0 and 16 parameters of any type.… Read more
Anonymous methods
Saturday, February 1st, 2020Remember from the lesson lambda expressions that we can declare a method locally, without a name, and use it only in one place, where we declare it. This is an example of a lambda expression:
using System;
namespace HelloWorld
{
public class Program
{
delegate bool SomeDelegate(int _param);
public static void Main()
{
SomeDelegate _delegate = i => i > 5;
Console.Read();… Read more