Working on linq queries

3_linq_queries
jason.zhu 2021-05-11 10:29:07 +10:00
parent 46766de185
commit af986b0d09
5 changed files with 101 additions and 3 deletions

27
.vscode/launch.json vendored 100644
View File

@ -0,0 +1,27 @@
{
"version": "0.2.0",
"configurations": [
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/Introduction/bin/Debug/netcoreapp3.1/Introduction.dll",
"args": [],
"cwd": "${workspaceFolder}/Introduction",
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
"console": "internalConsole",
"stopAtEntry": false
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}"
}
]
}

42
.vscode/tasks.json vendored 100644
View File

@ -0,0 +1,42 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/Introduction/Introduction.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/Introduction/Introduction.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"${workspaceFolder}/Introduction/Introduction.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
}
]
}

View File

@ -18,11 +18,9 @@ namespace Queries
{
if (predicate(item))
{
result.Add(item);
yield return item;
}
}
return result;
}
}
}

View File

@ -0,0 +1,23 @@
using System;
using System.Collections;
namespace yield_test
{
class Program
{
static void Main(string[] args)
{
foreach (var number in GetNumbers())
{
Console.WriteLine(number);
}
}
static IEnumerable GetNumbers()
{
yield return 1;
yield return 2;
yield return 3;
}
}
}

View File

@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
</Project>