Finished The Power of IEnumerable
parent
ced8f125ee
commit
7ac104a924
|
@ -0,0 +1,8 @@
|
|||
namespace Features
|
||||
{
|
||||
public class Employee
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
|
@ -0,0 +1,36 @@
|
|||
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"}
|
||||
};
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -5,6 +5,8 @@ VisualStudioVersion = 15.0.26124.0
|
|||
MinimumVisualStudioVersion = 15.0.26124.0
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Introduction", "Introduction\Introduction.csproj", "{AF71FD32-411A-42CD-A69F-DA60FB8E21A9}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Features", "Features\Features.csproj", "{94C9EE4C-0609-464B-9BFF-BA3EED2A7263}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
@ -30,5 +32,17 @@ Global
|
|||
{AF71FD32-411A-42CD-A69F-DA60FB8E21A9}.Release|x64.Build.0 = Release|Any CPU
|
||||
{AF71FD32-411A-42CD-A69F-DA60FB8E21A9}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{AF71FD32-411A-42CD-A69F-DA60FB8E21A9}.Release|x86.Build.0 = Release|Any CPU
|
||||
{94C9EE4C-0609-464B-9BFF-BA3EED2A7263}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{94C9EE4C-0609-464B-9BFF-BA3EED2A7263}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{94C9EE4C-0609-464B-9BFF-BA3EED2A7263}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{94C9EE4C-0609-464B-9BFF-BA3EED2A7263}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{94C9EE4C-0609-464B-9BFF-BA3EED2A7263}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{94C9EE4C-0609-464B-9BFF-BA3EED2A7263}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{94C9EE4C-0609-464B-9BFF-BA3EED2A7263}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{94C9EE4C-0609-464B-9BFF-BA3EED2A7263}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{94C9EE4C-0609-464B-9BFF-BA3EED2A7263}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{94C9EE4C-0609-464B-9BFF-BA3EED2A7263}.Release|x64.Build.0 = Release|Any CPU
|
||||
{94C9EE4C-0609-464B-9BFF-BA3EED2A7263}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{94C9EE4C-0609-464B-9BFF-BA3EED2A7263}.Release|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
Loading…
Reference in New Issue