Skip to content

Commit

Permalink
add
Browse files Browse the repository at this point in the history
  • Loading branch information
= committed Apr 20, 2023
0 parents commit d2f80f6
Show file tree
Hide file tree
Showing 8 changed files with 147 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bin
obj
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# C-sharp Training

- [Download .NET SDK](https://dotnet.microsoft.com/download)
- [Install the C# extension](https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csharp)
- Create a new project as follows.
```
dotnet new console -o app
cd app
code .
```
- Build your project
```bash
dotnet build
```
- Run your project
```bash
dotnet run
```
26 changes: 26 additions & 0 deletions app/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"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}/bin/Debug/net7.0/app.dll",
"args": [],
"cwd": "${workspaceFolder}",
// 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"
}
]
}
41 changes: 41 additions & 0 deletions app/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/app.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/app.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"--project",
"${workspaceFolder}/app.csproj"
],
"problemMatcher": "$msCompile"
}
]
}
24 changes: 24 additions & 0 deletions app/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");
Console.WriteLine("youssef is awesome!");

// variables
short aShort = 1;
byte aByte = 8;
int a = 22;
string s = "youssef";
float w = 155.5f;
double d = 188.8d;
bool b = false;

Console.WriteLine($"a={a}, s={s}, w={w}, b={b}, d={d}, aShort={aShort}, aByte={aByte}");

// declaration
int x;
int y;

// assignment
x = 22;
y = 33;

Console.WriteLine($"x={x}, y={y}");
10 changes: 10 additions & 0 deletions app/app.csproj
Original file line number Diff line number Diff line change
@@ -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>
16 changes: 16 additions & 0 deletions app1/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
int a = 10;
int b = 11;
int c = a + b;
int d = a - b;
int e = a * b;
int f = a / b;
double g = a / (double)b;
int h = a % b;


Console.WriteLine($"{a} + {b} = {c}");
Console.WriteLine($"{a} - {b} = {d}");
Console.WriteLine($"{a} * {b} = {e}");
Console.WriteLine($"{a} / {b} = {f}");
Console.WriteLine($"{a} / {b} = {g}");
Console.WriteLine($"{a} % {b} = {h}");
10 changes: 10 additions & 0 deletions app1/app1.csproj
Original file line number Diff line number Diff line change
@@ -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 comments on commit d2f80f6

Please sign in to comment.