Skip to content

Commit 7d9a11e

Browse files
authored
Merge pull request #39 from devlights:update-dotnet-version
Update README
2 parents fd474d4 + 784ae83 commit 7d9a11e

File tree

9 files changed

+66
-115
lines changed

9 files changed

+66
-115
lines changed

.gitpod.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ image: gitpod/workspace-dotnet:latest
22
tasks:
33
- name: dotnet restore
44
init: make restore
5+
- name: install task
6+
init: go install github.com/go-task/task/v3/cmd/task@latest
57
vscode:
68
extensions:
79
- muhammad-sammy.csharp

Makefile

Lines changed: 0 additions & 37 deletions
This file was deleted.

README.md

Lines changed: 42 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,74 @@
11
# try-csharp
22
This is my TUTORIAL project for csharp.
33

4-
![try-csharp - DotNet Version](https://img.shields.io/badge/dotnet-6.0-blue.svg)
4+
![try-csharp - DotNet Version](https://img.shields.io/badge/dotnet-7.0-blue.svg)
55
[![CodeFactor](https://www.codefactor.io/repository/github/devlights/try-csharp/badge)](https://www.codefactor.io/repository/github/devlights/try-csharp)
66
[![Gitpod Ready-to-Code](https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/devlights/try-csharp)
77

88
## Version
99

1010
```sh
1111
$ dotnet --info
12-
.NET SDK (reflecting any global.json):
13-
Version: 6.0.100
14-
Commit: 9e8b04bbff
12+
.NET SDK:
13+
Version: 7.0.100
14+
Commit: e12b7af219
1515

1616
Runtime Environment:
1717
OS Name: ubuntu
18-
OS Version: 20.04
18+
OS Version: 22.04
1919
OS Platform: Linux
20-
RID: ubuntu.20.04-x64
21-
Base Path: /home/gitpod/dotnet/sdk/6.0.100/
20+
RID: ubuntu.22.04-x64
21+
Base Path: /home/gitpod/dotnet/sdk/7.0.100/
2222

23-
Host (useful for support):
24-
Version: 6.0.0
25-
Commit: 4822e3c3aa
23+
Host:
24+
Version: 7.0.0
25+
Architecture: x64
26+
Commit: d099f075e4
2627

2728
.NET SDKs installed:
28-
6.0.100 [/home/gitpod/dotnet/sdk]
29+
7.0.100 [/home/gitpod/dotnet/sdk]
2930

3031
.NET runtimes installed:
31-
Microsoft.AspNetCore.App 6.0.0 [/home/gitpod/dotnet/shared/Microsoft.AspNetCore.App]
32-
Microsoft.NETCore.App 6.0.0 [/home/gitpod/dotnet/shared/Microsoft.NETCore.App]
33-
```
32+
Microsoft.AspNetCore.App 7.0.0 [/home/gitpod/dotnet/shared/Microsoft.AspNetCore.App]
33+
Microsoft.NETCore.App 7.0.0 [/home/gitpod/dotnet/shared/Microsoft.NETCore.App]
3434

35-
## Run (IDE)
36-
+ set TryCSharp.Tools.Cui project as 'startup project'
37-
+ run onto IDE
35+
Other architectures found:
36+
None
3837

39-
## Run (CLI)
38+
Environment variables:
39+
DOTNET_ROOT [/home/gitpod/dotnet]
40+
41+
global.json file:
42+
Not found
43+
```
44+
45+
## Environments
4046

4147
```sh
42-
$ cd TryCSharp.Tools.Cui
43-
$ dotnet run
48+
$ lsb_release -a
49+
No LSB modules are available.
50+
Distributor ID: Ubuntu
51+
Description: Ubuntu 22.04.2 LTS
52+
Release: 22.04
53+
Codename: jammy
4454
```
4555

46-
or
56+
## Requirements
57+
58+
### [go-task](https://taskfile.dev/)
4759

4860
```sh
49-
$ cd TryCSharp.Tools.Cui
50-
$ dotnet run --onetime
61+
$ go install github.com/go-task/task/v3/cmd/task@latest
5162
```
5263

53-
or
64+
## Run (IDE)
65+
66+
+ set TryCSharp.Tools.Cui project as 'startup project'
67+
+ run onto IDE
68+
69+
## Run (CLI)
5470

5571
```sh
56-
$ make run
72+
$ task run
73+
task: [run] dotnet run --project TryCSharp.Tools.Cui --onetime
5774
```

Taskfile.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# https://taskfile.dev
2+
3+
version: "3"
4+
5+
tasks:
6+
default:
7+
cmds:
8+
- task: run
9+
build:
10+
cmds:
11+
- dotnet build
12+
clean:
13+
cmds:
14+
- dotnet clean
15+
run:
16+
cmds:
17+
- dotnet run --project TryCSharp.Tools.Cui --onetime

TryCSharp.Common/TryCSharp.Common.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0</TargetFramework>
4+
<TargetFramework>net7.0</TargetFramework>
55
<RootNamespace>TryCSharp.Common</RootNamespace>
66
<LangVersion>latest</LangVersion>
77
<AssemblyName>TryCSharp.Common</AssemblyName>

TryCSharp.Samples/Basic/BitConverterSamples01.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public void Execute()
3636
bytes = new byte[] {1, 0, 0, 0};
3737
Output.WriteLine(BitConverter.ToInt32(bytes, 0));
3838

39-
bytes = BitConverter.GetBytes((byte) 'a');
39+
bytes = BitConverter.GetBytes((short) 'a');
4040
Output.WriteLine(BitConverter.ToChar(bytes, 0));
4141
}
4242
}

TryCSharp.Samples/Threading/ThreadLocalSamples01.cs

Lines changed: 1 addition & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public void Execute()
2222
// ・フィールドの値は常に、その型のデフォルト値で初期化される。初期値を設定しても無視される。
2323
//
2424
// ThreadLocal<T>は、上記の点を解決している。つまり
25-
// ・インスタンスフィールドに対応している。
25+
// ・インスタンスフィールドに対応している。(が、警告が出る)
2626
// ・フィールドの値を初期値で初期化出来る。
2727
//
2828
// 利用方法は、System.Lazyと似ており、コンストラクタに初期化のためのデリゲートを渡す。
@@ -66,46 +66,7 @@ public void Execute()
6666
countdown.Wait();
6767
}
6868

69-
//
70-
// インスタンスフィールドのThreadStatic属性の確認
71-
// ThreadStatic属性は、インスタンスフィールドに対しては効果が無い。
72-
// なので、出力される値は2,3,4,5,6...とインクリメントされていく.
73-
//
74-
using (var countdown = new CountdownEvent(numberOfParallels))
75-
{
76-
for (var i = 0; i < numberOfParallels; i++)
77-
{
78-
new Thread(() =>
79-
{
80-
Output.WriteLine("ThreadStatic [count3]>>> {0}", count3++);
81-
countdown.Signal();
82-
}).Start();
83-
}
84-
85-
countdown.Wait();
86-
}
87-
88-
//
89-
// インスタンスフィールドのThreadLocal<T>の確認
90-
// ThreadLocal<T>は、インスタンスフィールドに対しても問題なく利用できる。
91-
// なので、出力される値は4となる。
92-
//
93-
using (var countdown = new CountdownEvent(numberOfParallels))
94-
{
95-
for (var i = 0; i < numberOfParallels; i++)
96-
{
97-
new Thread(() =>
98-
{
99-
Output.WriteLine("ThreadLocal<T> [count4]>>> {0}", count4.Value++);
100-
countdown.Signal();
101-
}).Start();
102-
}
103-
104-
countdown.Wait();
105-
}
106-
10769
count2.Dispose();
108-
count4.Dispose();
10970
}
11071

11172
#region Static Fields
@@ -116,14 +77,5 @@ public void Execute()
11677
private static readonly ThreadLocal<int> count2 = new ThreadLocal<int>(() => 2);
11778

11879
#endregion
119-
120-
#region Fields
121-
122-
// ReSharper disable once ThreadStaticAtInstanceField
123-
[ThreadStatic] private int count3 = 2;
124-
125-
private readonly ThreadLocal<int> count4 = new ThreadLocal<int>(() => 4);
126-
127-
#endregion
12880
}
12981
}

TryCSharp.Samples/TryCSharp.Samples.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0</TargetFramework>
4+
<TargetFramework>net7.0</TargetFramework>
55
<RootNamespace>TryCSharp.Samples</RootNamespace>
66
<LangVersion>latest</LangVersion>
77
<AssemblyName>TryCSharp.Samples</AssemblyName>

TryCSharp.Tools.Cui/TryCSharp.Tools.Cui.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net6.0</TargetFramework>
5+
<TargetFramework>net7.0</TargetFramework>
66
<RootNamespace>TryCSharp.Tools.Cui</RootNamespace>
77
<LangVersion>latest</LangVersion>
88
<AssemblyName>TryCSharp.Tools.Cui</AssemblyName>

0 commit comments

Comments
 (0)