Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch 1 #805

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions Bootcamp.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,31 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Src", "Src", "{3E67C921-D34
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{7559227A-AC63-40F9-B43A-BF1D3CB352D6}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BootCamp.Chapter", "Src\BootCamp.Chapter\BootCamp.Chapter.csproj", "{AD4B9DF0-A466-44FE-ADB8-D16BE20E6A37}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BootCamp.Chapter1.Tests", "Tests\BootCamp.Chapter1.Tests\BootCamp.Chapter1.Tests.csproj", "{AF2F380C-7A0D-4328-9CF5-2D7E9A2051F8}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BootCamp.Chapter.Tests", "Tests\BootCamp.Chapter.Tests\BootCamp.Chapter.Tests.csproj", "{955C76C7-582C-4C12-A253-0551A59E630A}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BootCamp.Chapter1", "Src\BootCamp.Chapter1\BootCamp.Chapter1.csproj", "{BAEFB31B-57F6-4100-A9D1-AF01BFD5EB2D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{AD4B9DF0-A466-44FE-ADB8-D16BE20E6A37}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AD4B9DF0-A466-44FE-ADB8-D16BE20E6A37}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AD4B9DF0-A466-44FE-ADB8-D16BE20E6A37}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AD4B9DF0-A466-44FE-ADB8-D16BE20E6A37}.Release|Any CPU.Build.0 = Release|Any CPU
{955C76C7-582C-4C12-A253-0551A59E630A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{955C76C7-582C-4C12-A253-0551A59E630A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{955C76C7-582C-4C12-A253-0551A59E630A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{955C76C7-582C-4C12-A253-0551A59E630A}.Release|Any CPU.Build.0 = Release|Any CPU
{AF2F380C-7A0D-4328-9CF5-2D7E9A2051F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AF2F380C-7A0D-4328-9CF5-2D7E9A2051F8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AF2F380C-7A0D-4328-9CF5-2D7E9A2051F8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AF2F380C-7A0D-4328-9CF5-2D7E9A2051F8}.Release|Any CPU.Build.0 = Release|Any CPU
{BAEFB31B-57F6-4100-A9D1-AF01BFD5EB2D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BAEFB31B-57F6-4100-A9D1-AF01BFD5EB2D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BAEFB31B-57F6-4100-A9D1-AF01BFD5EB2D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BAEFB31B-57F6-4100-A9D1-AF01BFD5EB2D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{AD4B9DF0-A466-44FE-ADB8-D16BE20E6A37} = {3E67C921-D341-42FB-9934-B03C05A28BEB}
{955C76C7-582C-4C12-A253-0551A59E630A} = {7559227A-AC63-40F9-B43A-BF1D3CB352D6}
{AF2F380C-7A0D-4328-9CF5-2D7E9A2051F8} = {7559227A-AC63-40F9-B43A-BF1D3CB352D6}
{BAEFB31B-57F6-4100-A9D1-AF01BFD5EB2D} = {3E67C921-D341-42FB-9934-B03C05A28BEB}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {5969FA83-B2F9-4714-8336-EEBBDA71F6FF}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# CSharp-From-Zero-To-Hero
# C#: From Zero To Hero
[![Build Status](https://dev.azure.com/almantusk/From-Zero-To-Hero/_apis/build/status/Almantask.CSharp-From-Zero-To-Hero?branchName=master)](https://dev.azure.com/almantusk/From-Zero-To-Hero/_build/latest?definitionId=5&branchName=master)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/a358adf21c2442cd91a4827a50213ff1)](https://www.codacy.com/manual/Almantask/CSharp-From-Zero-To-Hero?utm_source=github.com&utm_medium=referral&utm_content=Almantask/CSharp-From-Zero-To-Hero&utm_campaign=Badge_Grade)
C# boot camp
12 changes: 0 additions & 12 deletions Src/BootCamp.Chapter/Program.cs

This file was deleted.

121 changes: 121 additions & 0 deletions Src/BootCamp.Chapter1/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
// Ignore using System; for now
using System;

// Ignore namespace BootCamp.Chapter1 for now
namespace BootCamp.Chapter1
{
// Ignore class Program for now.
class Program
{
// In C# comments are with "//"
/*
This is a multiline comment. It start with
"/*" and ends with "* /" (no space)
*/
// Comments are just text which will taken as an instruction, thus will be skipped.
// Running with VS menu will put application in debug mode.
// Running with "ctrl + F5" will put it in release mode.

// Every function has some entry point.
// Starting (entry) point of a console application is Main.
// Write code below, within Main.
static void Main(string[] args)
{
// PascalCase (first letter is capital and all other words start with capital letter)
// camelCase (first letter is non-capital and all other words start with capital letter)

// for variable names we can use: [aA-zZ], [0-9], _

// whole numbers:
// 32 bit
int myAge = 25;

// 64 bit
long lightyears = 9999999999999999;

// numbers with a fraction:
// floats are fast, 32 bit
float weight = 80.5f;
float height = 201.1f;

// double precision compared:
// doubles are slower, 64 bit
// double is a default number type with fraction
double number6 = 2.5;

// decimal is explicitly used for money and scientific calculations
// (decimal) means that from double to decimal
// 128 bit
decimal money = (decimal)10000000000000000000000.156465465465465464654654654654654654654654;

// string is used to store text:
// double quotes ("")
string myName = "Kaisinel";

// char is used for storing a single symbol
// single quotes ('')
char firstLetter = 'K';

// for binary types (logical- true or false) we use boolean.
bool isItFirstLesson = true;
bool isItLastLesson = false;

// var can be used as an alternative to define a variable with a type.
var variablesDone = "Variables done";
var timeNow = 10;
// doesn't work -var unknown;
Console.WriteLine(myName);

// We can add any two nubmers together
int sum = 1 + 5; // 6
int sumx2 = sum + sum; // 12
sumx2 = sumx2 * 2; // 24
var sumMoreFloat = sumx2 + 2.0f;
var sumMoreDecimal = (decimal)sumMoreFloat + (decimal)1.000001;
Console.WriteLine(sumMoreDecimal);

// We can add string and other primitives to a string and so they all become string:
var greetings = "Hello world!";
var fullGreeting = myName + ", " + greetings;
var fullGreetingTimes = fullGreeting + 1;
Console.WriteLine(fullGreetingTimes);

var a = 'a';
// char + string = string
// (int)char = ascii
Console.WriteLine(a + " is " + (int)a);
var b = 'b';
Console.WriteLine(b + " is " + (int)b);
// char + char = int
var aAndB = a + b;
Console.WriteLine("a + b =" + aAndB);
Console.WriteLine("What symbol goes after 'Z' in ascii?");
// char + int = int
var afterZ = Convert.ToChar('Z' + 1);
Console.WriteLine("Answer: " + afterZ);

// we cannot substract string
// how many letters in alphabet:
Console.WriteLine("Letters in alphabet: " + ('z' - 'a') + 1);

// you can only multiply and divide number
// dividing an integer from an integer ignores a fraction part.
var divisionResult = 1 / 100;
Console.WriteLine(divisionResult);
// dividing an integer from a number with a fraction keeps a fraction part.
var divisionResultFraction = 1 / 100.0;
Console.WriteLine(divisionResultFraction);
var hundred = 100;
var hundredHundreds = hundred * 100.0f;
Console.WriteLine(hundredHundreds);

// Values that don't change, should be used as a constant.
const double pi = 3.1415926535;

Console.Write("Input your name: ");
// Read line of text from console.
string name = Console.ReadLine();
Console.WriteLine("Hello again, " + name);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\Src\BootCamp.Chapter\BootCamp.Chapter.csproj" />
<ProjectReference Include="..\..\Src\BootCamp.Chapter1\BootCamp.Chapter1.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Xunit;

namespace BootCamp.Chapter.Tests
namespace BootCamp.Chapter1.Tests
{
// You don't have to be here for a long time.
public class UnitTest1
Expand Down