Skip to content

Instantly share code, notes, and snippets.

View syedharoonmca's full-sized avatar

syedharoonmca

View GitHub Profile
@syedharoonmca
syedharoonmca / LINQMethodSyntax..cs
Last active December 5, 2022 04:30
LINQ Method Syntax
using System;
using System.Collections.Generic;
using System.Linq;
namespace LINQDemo
{
class Program
{
static void Main(string[] args)
{
@syedharoonmca
syedharoonmca / MixedSyntax.cs
Created December 5, 2022 04:34
MixedSyntax
using System;
using System.Collections.Generic;
using System.Linq;
namespace LINQDemo
{
class Program
{
static void Main(string[] args)
{
@syedharoonmca
syedharoonmca / LINQQuerySyntax.cs
Last active December 5, 2022 06:32
LINQQuerySyntax
using System;
using System.Collections.Generic;
using System.Linq;
namespace LINQDemo
{
class Program
{
static void Main(string[] args)
{
//Data Source
using System;
using System.Linq;
using System.Collections.Generic;
public class Program
{
public static void Main()
{
// Student collection
public class Student{
public int StudentID { get; set; }
public string StudentName { get; set; }
public int Age { get; set; }
}
public class Person
{
public string Forename { get; set; }
public string Surname { get; set; }
public DateTime DateOfBirth { get; set; }
}
var people = new List<Person>()
{
new Person()
{
Forename = "John",
Surname = "Smith",
DateOfBirth = new DateTime(1980, 6, 14)
},
new Person()
{
using System;
using System.Linq;
using System.Collections.Generic;
public class Program
{
public static void Main()
{
// Student collection
using System;
using System.Linq;
using System.Collections.Generic;
public class Program
{
public static void Main()
{
// Student collection
List<int> intList =new List<int>{1,2,3,4,5,6,7,8,9,10};
IEnumeralbe<int> EvenNumberList =intList.Where(n=> n%2 == 0);