X.0

Be sure to uncheck print layout

view > print layout

Be sure to use the outline

tools > Document Outline

Be sure to leave comments

Highlight &  Ctrl + Alt + M

Be sure to use search

Ctrl + F

Check out the Discord

Click Here

Check out my Github

Click Here


X.1

SYSTEM > Variables, Write/Read, Sleep, Exit

Basics

X.2

SYSTEM > Class/Function, Loop, If/Else

Basics 2

X.3

SYSTEM > RNG, Text Color

Misc.


— Document Simplicities —

V = Variable = A variable represents a numeric or string value or an object of a class.

S = String = Any finite sequence of characters.

N = Number = Any finite number.

’  ’ = Fixed argument = Text related to the name // EX: ’color’

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

RNG = Random Number Generator.

VS = Visual Studio


— Using Visual Studio / Windows —

VS 2017 = Download here

VS Start Page = File > Start Page

VS text overwrite = INSERT key.

VS Reverse Tab = Shift + Tab

VS syntax color = Tools > Options > Environment > Fonts and Colors

Windows System Errors = ‘Win + R’ > msinfo32 > Software Environment > Windows Error Reporting

Windows Appdata shortcut = ‘Win + R’ > “shell:Appdata”

Windows Startup Programs = Navigate to: “AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup” > Place shortcut here.


— Using Command Prompt —

CMD Compile = csc “cs file”;; EX: “csc program.cs” ;; EX: “csc mainmenu.cs gameplay.cs”

Setup ^ = Open CMD > type “path =%path%;C:\Windows\Microsoft.NET\Framework64\v4.0.30319”

CMD Directory: Drive = “Letter + :” ;; Folder = “cd\name\name…”



Copied with “Productivity Power Tools 2017” - Extensions & updates plugin for VS2017

Page setup tabloid 11” x 17” | Border top & down = 0.1 w/ left & right = 0.25

Background color - #1e1e1e | Cellpadding = 0.04

X.1

  1. using System; //Dynamic Link Library "System"
  2.  
  3. namespace CSharp_lang
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             Console.WriteLine("Hello there"); //Writes a new line.
  10.             string question = ("What is your name: "); //Creates string Variable
  11.             Console.Write(question); //Writes just a line.
  12.             string UserName = Console.ReadLine(); //Saves user input.
  13.  
  14.             Console.WriteLine("Hello, " + UserName); //Prints multiple strings together.
  15.             Console.WriteLine(UserName.ToLower() + " ,What is your favorite single digit number?: ");
  16.             ConsoleKeyInfo Number = Console.ReadKey(); //Save User input, but only one character.
  17.             Console.WriteLine(); //Writes an empty line.
  18.             Console.WriteLine("Interesting choice: {0}", Number.KeyChar.ToString()); //Another way to print multiple strings.
  19.  
  20.             System.Threading.Thread.Sleep(2000); //Pauses program for 2 seconds.
  21.             Console.Clear(); //Removes all text from Console.
  22.             Console.WriteLine("Goodbye...");
  23.             int Yo = 3000; //Creates int Variable
  24.             System.Threading.Thread.Sleep(Yo); //Another sleep, but with Variable.
  25.             Environment.Exit(0); //Exits program.
  26.         }
  27.     }
  28. }

— Main Notes —

— Sub Notes —

  • Write

Console.Write(); Prints to Console, Console.WriteLine(); Newline write, Console.Write(v); Prints from Variable

  • Write Combinations

(); = blank, ("S"); = string,  (V); = Variable, ("S" + V); &  ("S {0}", V); = String combinations

  • Read

Console.ReadLine(); Saves User Input, Console.ReadKey(); Readline but one Character.

  • Exit

(0) No Issue Exit, (1) Error Occured, More Exit Codes

— External Resources —

— Quick Tips —


X.2

  1. using System; //Dynamic Link Library "System"
  2.  
  3. namespace CSharp_lang
  4. {
  5.     class Program 
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             while (true)
  10.             {
  11.                 Console.WriteLine("Type a single digit number: ");
  12.                 ConsoleKeyInfo UserInput = Console.ReadKey();
  13.  
  14.                 if (char.IsNumber(UserInput.KeyChar))
  15.                 {
  16.                     Checked.Number();
  17.                     Break;
  18.                 }
  19.                 else if (Char.IsLetter(UserInput.KeyChar))
  20.                 {
  21.                     NotNumber();
  22.                     Continue;
  23.                 }
  24.                 else
  25.                 {
  26.                     Console.WriteLine("You're crazy!");
  27.                 }
  28.             }
  29.         }
  30.         static void NotNumber()
  31.         {
  32.             Console.WriteLine("You did not type an integer");
  33.         }
  34.     }
  35.     class Checked
  36.     {
  37.         public static void Number()
  38.         {
  39.             Console.WriteLine("Cool...\n Now exiting...");
  40.         }
  41.     }
  42. }

— Main Notes —

— Sub Notes —

  • Within char options

.IsLetter = Alphabetical character, .IsNumber = Numerical character

  • Logics

if = Check if true, else if  = If previous check is false then check if this is true, else = If all false then do this

  • Return functions

public static string V() = returns string, public static int V() = returns int

  • While loops

 continue; = Goes back to the beginning, break; = Breaks out of the operation basically ending it

— Quick Tips —


X.3

  1. using System; //Dynamic Link Library "System"
  2.  
  3. namespace CSharp_lang
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int c = 0;
  10.             int i = 0;
  11.             Random Rando = new Random();
  12.  
  13.             while (true)
  14.             {
  15.                 Console.ForegroundColor = ConsoleColor.Cyan;
  16.                 Console.Write("Guess my number 1 - 10: ");
  17.                 string UserInput = Console.ReadLine();
  18.  
  19.                 if (UserInput.Length > 0)
  20.                 {
  21.                     int UserNumber = Convert.ToInt32(UserInput);
  22.                     int randomNumber = Rando.Next(10) + 1;
  23.                     if (UserNumber == randomNumber)
  24.                     {
  25.                         Console.ForegroundColor = ConsoleColor.Green;
  26.                         Console.WriteLine(randomNumber);
  27.                         Console.WriteLine("Nice!");
  28.                         C++;
  29.                         Console.WriteLine("{0} Correct: {1} Incorrect", c, i);
  30.                         Console.ForegroundColor = ConsoleColor.Cyan;
  31.                     }
  32.                     else if (UserNumber != randomNumber)
  33.                     {
  34.                         Console.ForegroundColor = ConsoleColor.Red;
  35.                         Console.WriteLine(randomNumber);
  36.                         Console.WriteLine("Try again!");
  37.                         I++;
  38.                         Console.WriteLine("{0} Correct: {1} Incorrect", c, i);
  39.                         Console.ForegroundColor = ConsoleColor.Cyan;
  40.                     }
  41.                 }
  42.                 Else
  43.                 {
  44.                     Console.WriteLine("You dind't type anything!");
  45.                 }
  46.             }
  47.         }
  48.     }
  49. }

— Main Notes —

— Sub Notes —

  • Console Color

= ConsoleColor.Cyan; By color name, = (ConsoleColor)V; By int Variable

  • and/or

 ||  For “or”,  &&  For “and”

  • RNG ints

= V.Next(int); = Creates a number within int range, = V.Next(int) + int; = range + int

— Quick Tips —