parent
7642d89035
commit
398c8d85cc
@ -0,0 +1,24 @@ |
|||||||
|
{ |
||||||
|
// IntelliSense를 사용하여 가능한 특성에 대해 알아보세요. |
||||||
|
// 기존 특성에 대한 설명을 보려면 가리킵니다. |
||||||
|
// 자세한 내용을 보려면 https://go.microsoft.com/fwlink/?linkid=830387을(를) 방문하세요. |
||||||
|
"version": "0.2.0", |
||||||
|
"configurations": [ |
||||||
|
{ |
||||||
|
"name": ".NET Core Launch (console)", |
||||||
|
"type": "coreclr", |
||||||
|
"request": "launch", |
||||||
|
"preLaunchTask": "build", |
||||||
|
"program": "${workspaceFolder}/treeStructure/bin/Debug/net7.0/treeStructure.dll", |
||||||
|
"args": [], |
||||||
|
"cwd": "${workspaceFolder}/treeStructure", |
||||||
|
"console": "internalConsole", |
||||||
|
"stopAtEntry": false |
||||||
|
}, |
||||||
|
{ |
||||||
|
"name": ".NET Core Attach", |
||||||
|
"type": "coreclr", |
||||||
|
"request": "attach" |
||||||
|
} |
||||||
|
] |
||||||
|
} |
@ -0,0 +1,41 @@ |
|||||||
|
{ |
||||||
|
"version": "2.0.0", |
||||||
|
"tasks": [ |
||||||
|
{ |
||||||
|
"label": "build", |
||||||
|
"command": "dotnet", |
||||||
|
"type": "process", |
||||||
|
"args": [ |
||||||
|
"build", |
||||||
|
"${workspaceFolder}/treeStructure/treeStructure.csproj", |
||||||
|
"/property:GenerateFullPaths=true", |
||||||
|
"/consoleloggerparameters:NoSummary" |
||||||
|
], |
||||||
|
"problemMatcher": "$msCompile" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"label": "publish", |
||||||
|
"command": "dotnet", |
||||||
|
"type": "process", |
||||||
|
"args": [ |
||||||
|
"publish", |
||||||
|
"${workspaceFolder}/treeStructure/treeStructure.csproj", |
||||||
|
"/property:GenerateFullPaths=true", |
||||||
|
"/consoleloggerparameters:NoSummary" |
||||||
|
], |
||||||
|
"problemMatcher": "$msCompile" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"label": "watch", |
||||||
|
"command": "dotnet", |
||||||
|
"type": "process", |
||||||
|
"args": [ |
||||||
|
"watch", |
||||||
|
"run", |
||||||
|
"--project", |
||||||
|
"${workspaceFolder}/treeStructure/treeStructure.csproj" |
||||||
|
], |
||||||
|
"problemMatcher": "$msCompile" |
||||||
|
} |
||||||
|
] |
||||||
|
} |
@ -0,0 +1,10 @@ |
|||||||
|
<Project Sdk="Microsoft.NET.Sdk"> |
||||||
|
|
||||||
|
<PropertyGroup> |
||||||
|
<OutputType>Exe</OutputType> |
||||||
|
<TargetFramework>net7.0</TargetFramework> |
||||||
|
<ImplicitUsings>enable</ImplicitUsings> |
||||||
|
<Nullable>enable</Nullable> |
||||||
|
</PropertyGroup> |
||||||
|
|
||||||
|
</Project> |
@ -0,0 +1,10 @@ |
|||||||
|
<Project Sdk="Microsoft.NET.Sdk"> |
||||||
|
|
||||||
|
<PropertyGroup> |
||||||
|
<OutputType>Exe</OutputType> |
||||||
|
<TargetFramework>net7.0</TargetFramework> |
||||||
|
<ImplicitUsings>enable</ImplicitUsings> |
||||||
|
<Nullable>enable</Nullable> |
||||||
|
</PropertyGroup> |
||||||
|
|
||||||
|
</Project> |
@ -0,0 +1,10 @@ |
|||||||
|
<Project Sdk="Microsoft.NET.Sdk"> |
||||||
|
|
||||||
|
<PropertyGroup> |
||||||
|
<OutputType>Exe</OutputType> |
||||||
|
<TargetFramework>net7.0</TargetFramework> |
||||||
|
<ImplicitUsings>enable</ImplicitUsings> |
||||||
|
<Nullable>enable</Nullable> |
||||||
|
</PropertyGroup> |
||||||
|
|
||||||
|
</Project> |
@ -0,0 +1,46 @@ |
|||||||
|
using System; |
||||||
|
using System.Collections; |
||||||
|
using System.Collections.Concurrent; |
||||||
|
using System.Threading; |
||||||
|
using System.Threading.Tasks; |
||||||
|
|
||||||
|
namespace treeStructure.Structure |
||||||
|
{ |
||||||
|
public class UseConcurrentDictionary |
||||||
|
{ |
||||||
|
public static void DoWork() |
||||||
|
{ |
||||||
|
ConcurrentDictionary<int, string> dict = new ConcurrentDictionary<int, string>(); |
||||||
|
|
||||||
|
Task t1 = Task.Factory.StartNew(() => |
||||||
|
{ |
||||||
|
int key = 1; |
||||||
|
while (key <= 100) |
||||||
|
{ |
||||||
|
if (dict.TryAdd(key, $"D{key}")) |
||||||
|
key++; |
||||||
|
|
||||||
|
Thread.Sleep(100); |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
Task t2 = Task.Factory.StartNew(() => |
||||||
|
{ |
||||||
|
int key = 1; |
||||||
|
string val; |
||||||
|
while (key <= 100) |
||||||
|
{ |
||||||
|
if (dict.TryGetValue(key, out val)) |
||||||
|
{ |
||||||
|
Console.WriteLine($"[{key}] {val}"); |
||||||
|
key++; |
||||||
|
} |
||||||
|
|
||||||
|
Thread.Sleep(100); |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
Task.WaitAll(t1, t2); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,19 @@ |
|||||||
|
using System; |
||||||
|
using System.Collections; |
||||||
|
|
||||||
|
namespace treeStructure.Structure |
||||||
|
{ |
||||||
|
public class UseDictionary |
||||||
|
{ |
||||||
|
public static void DoWork() |
||||||
|
{ |
||||||
|
Dictionary<int, string> emp = new Dictionary<int, string>(); |
||||||
|
emp.Add(1001, "Jane"); |
||||||
|
emp.Add(1002, "Tom"); |
||||||
|
emp.Add(1003, "Cindy"); |
||||||
|
|
||||||
|
string name = emp[1002]; |
||||||
|
Console.WriteLine(name); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,18 @@ |
|||||||
|
using System; |
||||||
|
using System.Collections; |
||||||
|
|
||||||
|
namespace treeStructure.Structure |
||||||
|
{ |
||||||
|
public class UseHashTable |
||||||
|
{ |
||||||
|
public static void DoWork() |
||||||
|
{ |
||||||
|
Hashtable ht = new Hashtable(); |
||||||
|
ht.Add("irina", "Irina SP"); |
||||||
|
ht.Add("tom", "Tom cr"); |
||||||
|
|
||||||
|
if (ht.Contains("tom")) |
||||||
|
Console.WriteLine(ht["tom"]); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,10 @@ |
|||||||
|
<Project Sdk="Microsoft.NET.Sdk"> |
||||||
|
|
||||||
|
<PropertyGroup> |
||||||
|
<OutputType>Exe</OutputType> |
||||||
|
<TargetFramework>net7.0</TargetFramework> |
||||||
|
<ImplicitUsings>enable</ImplicitUsings> |
||||||
|
<Nullable>enable</Nullable> |
||||||
|
</PropertyGroup> |
||||||
|
|
||||||
|
</Project> |
Loading…
Reference in new issue