add csharp examples (#10)
This commit is contained in:
committed by
Aditya Bhargava
parent
c3396b8b0a
commit
62ed616954
2
05_hash_tables/csharp/01_price_of_groceries/.gitignore
vendored
Normal file
2
05_hash_tables/csharp/01_price_of_groceries/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
**/bin/*
|
||||
**/obj/*
|
||||
23
05_hash_tables/csharp/01_price_of_groceries/.vscode/launch.json
vendored
Normal file
23
05_hash_tables/csharp/01_price_of_groceries/.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": ".NET Core Launch (console)",
|
||||
"type": "coreclr",
|
||||
"request": "launch",
|
||||
"preLaunchTask": "build",
|
||||
"program": "${workspaceRoot}/bin/Debug/netcoreapp1.0/01_price_of_groceries.dll",
|
||||
"args": [],
|
||||
"cwd": "${workspaceRoot}",
|
||||
"externalConsole": false,
|
||||
"stopAtEntry": false,
|
||||
"internalConsoleOptions": "openOnSessionStart"
|
||||
},
|
||||
{
|
||||
"name": ".NET Core Attach",
|
||||
"type": "coreclr",
|
||||
"request": "attach",
|
||||
"processId": "${command.pickProcess}"
|
||||
}
|
||||
]
|
||||
}
|
||||
16
05_hash_tables/csharp/01_price_of_groceries/.vscode/tasks.json
vendored
Normal file
16
05_hash_tables/csharp/01_price_of_groceries/.vscode/tasks.json
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"version": "0.1.0",
|
||||
"command": "dotnet",
|
||||
"isShellCommand": true,
|
||||
"args": [],
|
||||
"tasks": [
|
||||
{
|
||||
"taskName": "build",
|
||||
"args": [
|
||||
"${workspaceRoot}/project.json"
|
||||
],
|
||||
"isBuildCommand": true,
|
||||
"problemMatcher": "$msCompile"
|
||||
}
|
||||
]
|
||||
}
|
||||
20
05_hash_tables/csharp/01_price_of_groceries/Program.cs
Normal file
20
05_hash_tables/csharp/01_price_of_groceries/Program.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ConsoleApplication
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
var book = new Dictionary<string, decimal>();
|
||||
book.Add("apple", 0.67m);
|
||||
book.Add("milk", 1.49m);
|
||||
book.Add("avocado", 1.49m);
|
||||
foreach (var item in book)
|
||||
{
|
||||
Console.WriteLine($"{item.Key}: {item.Value}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
19
05_hash_tables/csharp/01_price_of_groceries/project.json
Normal file
19
05_hash_tables/csharp/01_price_of_groceries/project.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"version": "1.0.0-*",
|
||||
"buildOptions": {
|
||||
"debugType": "portable",
|
||||
"emitEntryPoint": true
|
||||
},
|
||||
"dependencies": {},
|
||||
"frameworks": {
|
||||
"netcoreapp1.0": {
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.App": {
|
||||
"type": "platform",
|
||||
"version": "1.0.1"
|
||||
}
|
||||
},
|
||||
"imports": "dnxcore50"
|
||||
}
|
||||
}
|
||||
}
|
||||
6598
05_hash_tables/csharp/01_price_of_groceries/project.lock.json
Normal file
6598
05_hash_tables/csharp/01_price_of_groceries/project.lock.json
Normal file
File diff suppressed because it is too large
Load Diff
2
05_hash_tables/csharp/02_check_voter/.gitignore
vendored
Normal file
2
05_hash_tables/csharp/02_check_voter/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
**/bin/*
|
||||
**/obj/*
|
||||
23
05_hash_tables/csharp/02_check_voter/.vscode/launch.json
vendored
Normal file
23
05_hash_tables/csharp/02_check_voter/.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": ".NET Core Launch (console)",
|
||||
"type": "coreclr",
|
||||
"request": "launch",
|
||||
"preLaunchTask": "build",
|
||||
"program": "${workspaceRoot}/bin/Debug/netcoreapp1.0/02_check_voter.dll",
|
||||
"args": [],
|
||||
"cwd": "${workspaceRoot}",
|
||||
"externalConsole": false,
|
||||
"stopAtEntry": false,
|
||||
"internalConsoleOptions": "openOnSessionStart"
|
||||
},
|
||||
{
|
||||
"name": ".NET Core Attach",
|
||||
"type": "coreclr",
|
||||
"request": "attach",
|
||||
"processId": "${command.pickProcess}"
|
||||
}
|
||||
]
|
||||
}
|
||||
16
05_hash_tables/csharp/02_check_voter/.vscode/tasks.json
vendored
Normal file
16
05_hash_tables/csharp/02_check_voter/.vscode/tasks.json
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"version": "0.1.0",
|
||||
"command": "dotnet",
|
||||
"isShellCommand": true,
|
||||
"args": [],
|
||||
"tasks": [
|
||||
{
|
||||
"taskName": "build",
|
||||
"args": [
|
||||
"${workspaceRoot}/project.json"
|
||||
],
|
||||
"isBuildCommand": true,
|
||||
"problemMatcher": "$msCompile"
|
||||
}
|
||||
]
|
||||
}
|
||||
29
05_hash_tables/csharp/02_check_voter/Program.cs
Normal file
29
05_hash_tables/csharp/02_check_voter/Program.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ConsoleApplication
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
private static Dictionary<string, bool> _voted = new Dictionary<string, bool>();
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
CheckVoter("tom");
|
||||
CheckVoter("mike");
|
||||
CheckVoter("mike");
|
||||
}
|
||||
|
||||
private static void CheckVoter(string name)
|
||||
{
|
||||
if (_voted.ContainsKey(name))
|
||||
{
|
||||
Console.WriteLine("kick them out!");
|
||||
}
|
||||
else
|
||||
{
|
||||
_voted.Add(name, true);
|
||||
Console.WriteLine("let them vote!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
19
05_hash_tables/csharp/02_check_voter/project.json
Normal file
19
05_hash_tables/csharp/02_check_voter/project.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"version": "1.0.0-*",
|
||||
"buildOptions": {
|
||||
"debugType": "portable",
|
||||
"emitEntryPoint": true
|
||||
},
|
||||
"dependencies": {},
|
||||
"frameworks": {
|
||||
"netcoreapp1.0": {
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.App": {
|
||||
"type": "platform",
|
||||
"version": "1.0.1"
|
||||
}
|
||||
},
|
||||
"imports": "dnxcore50"
|
||||
}
|
||||
}
|
||||
}
|
||||
6598
05_hash_tables/csharp/02_check_voter/project.lock.json
Normal file
6598
05_hash_tables/csharp/02_check_voter/project.lock.json
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user