pluralsight-linq-fundamentals/Features/Program.cs

38 lines
1007 B
C#

using System;
using System.Collections;
using System.Collections.Generic;
namespace Features
{
class Program
{
// Modelling a company in this project
static void Main(string[] args)
{
IEnumerable<Employee> developers = new Employee[]
{
new Employee {Id = 1, Name = "Scott"},
new Employee {Id = 2, Name = "Chris"}
};
List<Employee> sales = new List<Employee>()
{
new Employee {Id = 3, Name = "Alex"}
};
Console.WriteLine(sales.MyLinqCount());
var enumerator = developers.GetEnumerator();
while (enumerator.MoveNext())
{
Console.WriteLine(enumerator.Current.Name); // .Current return value of current enumerator
}
foreach (var person in developers)
{
Console.WriteLine();
}
}
}
}