Skip to content
Sign upLog in
← Back to Community

C# FULL Beginners Crash Course

Profile icon

C# Full Beginners Crash Course

Hello fellow replitors.

This course is dedicated to me.


Let's get started.

Table of contents

  • Introduction
  • Setup
  • Overview of a basic C# file
  • Hello, World!
  • Variables
  • Basic OOP Overview
  • Input
  • Functions
  • IF Statement
  • WHILE Loop
  • FOR Loop
  • Interesting Features
  • In-Depth OOP
  • Where to go from here
  • Conclusion
  • Bibliography


C# is an Object-Oriented, strongly typed, and overall great language developed by Microsoft in 2000.

It is kind of a Java-Wannabe.

In terms of this it wants to be cross-platform but barely.

It works great on windows but not so well on other platforms.

Today we will be focusing on the cross-platform side of C#

It is still a great language though.


This course is accelerated so I will not be going in depth in many topics, for instance what an array is. Mainly this tutorial will be HOWs and all WHYs will mainly be about best practices and not metaphors.

This course is aimed at people with a Python, Java, C, or C++ background.

If you know HTML, CSS, JS, TS, Ruby, or anything else you can still learn but it may be slightly harder.

The course will NOT teach you an IDE you can use or learn an IDE but I am not here to teach you an IDE.

But without further ado let's get a move on.


For NOW use but later I'd recommend using a real IDE and or compiler.

Overview of a basic C# file.

using System; class MainClass { public static void Main (string[] args) { <code> } }

Let's break down the file.

using System;? Well that is kind of like a #include or import statement. It's how we include new commands in our program.

The MainClass class is well, a class.

If you have no idea what a class is here is a basic overview.

Think about you driving a car the car has attributes, speed, brand, model, ect.

This car also has methods like starting it up, moving it, ect.

So, this is kind of like a class.

The class has methods and attributes,

Kind of like a data type.

The data type int might have a method called makeNegative() and an attribute called value.

Does that make sense?

Anyway public static void Main (string[] args) wow that is a mouthfull.

This is an example of a method!

The public is an identifier saying who can access this variable. See private.

The static means that the value of this method can never change.

The void means that this method returns nothing.

Main is the name. You must have a main class in your program for it to run and compile.

The (string[] args) is hard to explain if you don't come from a Java background.

When the user runs the program, they can specify args: myprogram.exe arg1 arg2.

And it turns them into a string array.

So you can reference them in your function!

Make sense?

Hello, World!

Okay finally, results!

So printing to the console is as easy as this:

Console.WriteLine("Hello, World!");

Notice that most lines in C# end with a semicolon or a bracket.

Also C# is cAsE seNsiTivE so remember that.

The Console is a class in the System library that we imported using using System;.

And WriteLine is a method of Console.

This method takes a string type as an argument. We will go in depth on data types in the next section.


In this section we will discuss Variables and Data Types in C#

Data Types

  • int , a 32-bit signed integer
  • float , a 32-bit signed floating point value.
  • long , a 64-bit signed integer
  • double , a 64-bit signed number (decimal or not)
  • byte , a 8-bit signed integer
  • bool , a True, False value (1 byte)
  • char , a single unicode character a, b, c, ect. Surrounded by 's
  • string , multiple char types abc, def, ghi, ect. Surrounded by "s

Declaring Variables without giving them an immidiate value.

Consider the code below

int x;

The syntax is <type> <name>;.

Declaring & Assigning a variable.

int x = 1;

The syntax is <type> <name> = <value>;.

Examples of various variable assignments

Some types in C# have special ways to assign them.

Lets review these.


float y = 1.5f;

We put an f at the end because the value defaults to a double type.


double x = 5.5;


char y = 'a';

We put 's around the value to indicate that we are using a char type.


string x = "Hello World";

We put "s around the value to indicate that we are using a string type.

That's about it for basic variables.

Basic OOP Overview.

OOP or Object Oriented Programming is the fork of programming revolving around classes and such.

If you do Java or C++ this is probably engraved into your mind anyway.

We discussed Classes a bit in the section Hello, World!.

They have methods and attributes.


  • Member - (Methods & Attributes)
  • Instance - A object using that class
  • Method - a function in that class
  • Attribute - a sort of identifier but not really.

We will review how to make classes, methods, ect. in the section In-Depth OOP.


Short section but still important.

So to read a line we can do.


And this will return a value of type string that is the input.

So we can do.

string x = Console.ReadLine();

To read a single key without the user having to press enter afterword we can do:

char y = Console.ReadKey();

And it returns a char.


Okay, functions or methods are really easy.


Identifiers are things that can tell the compiler who can access this class/method, if it can ever change, ect.

Let's go over a few.

Access Modifiers

  • public - everyone can access this.
  • private - can only be accessed in the class itself
  • internal - can only be accessed in the current project assembly.
  • protected - can only be accessed within the class or any classes that inherit from the class

Other Modifiers

  • static - only instanciated once and never reinstated.
  • abstract - tells the compiler that the object being changed has a missing or incomplete implementation.
  • virtual - used to change a method, property, indexer, or event declaration and allow for it to be overridden in a derived class.
  • const - used with variables to declare that its value can never change


Consider the example below:

private static void ex1 (string n) { Console.WriteLine("Hello" + n + "!"); }

The syntax is <modifiers> <return_type> <name> (<args>)

Darn that is a headache, let's break this down.

The modifiers are things like protected or abstract.

The return type is what the function returns (data type).

The return type in the example above is void that means that the function returns nothing.

The name is a way to reference the function.

The args have their own syntax:

<type> <name>

They are function-scope variables.

The code in the function must be in brackets.

IF statement.

Logic, finally.

Okay so if you are not familiar with an if statement, then learn more of your best language then come back here.

But we can show you syntax here:

if (<condition>) { <code that executes if the condition is true> }


  • != - Does not equal
  • == - equals
  • >= or => - greater than or equal to
  • <= or =< - less than or equal to.
  • > - greater than
  • < - less than
  • && - and
  • || - or

Else if and Else

Else if has the same syntax as if, it executes if the prior if and or else if statements weren't executed but this condition is true.

Else statements executes if the prior if and else if statements werent true:


Else { <code> }


As much as I despise the WHILE Loop and encourage the FOR Loop most people love the WHILE Loop.

So I need to cover it.

The syntax is:

while (<condition>) { <code block to be executed> }

And the same operators can be used in the WHILE Loop as well as in the IF statement.

That is pretty much it, haha.

FOR Loop

for (<statement 1>; <statement 2>; <statement 3>) { <code block to be executed> }

Statement 1 runs one time before the execution of the code.

Statement 2 defines the condition for executing the code.

Statement 3 runs every time after the code is executed.

Interesting Features

C# .NET comes with many different features.

Let's Look at a few.



It makes a beeping sound. Doesn't work on






It increments the value by 1.

In-Depth OOP

Okay this section is going to be really big. Just kiding I'm going to make it as quick and simple as possible


I hope at this point you understand what a class is.


<modifiers> class <name> { <code> }

The modifiers are the same as in functions section.


// These are just functions



As defined in Basic OOP Overview. these are kind of like indentifiers except not.

They are a whole other fork and I won't really show you how to make them but I want you to know what they are.

But I'll show you an example from the Microsoft Documentation:

[System.Runtime.InteropServices.DllImport("user32.dll")] extern static void SampleMethod();

A method with the attribute DllImportAttribute is declared.

Okay so yeah they are kinda difficult.


Take this example from the Microsoft Documentation:

using System; public class A { private int value = 10; public class B : A { public int GetValue() { return this.value; } } } public class C : A { // public int GetValue() // { // return this.value; // } } public class Example { public static void Main(string[] args) { var b = new A.B(); Console.WriteLine(b.GetValue()); } } // The example displays the following output: // 10

Inheritance is the act of one class inheriting from another.

Again a very in-depth field.

Where to go from here.

I'd suggest making a few programs and checking out the Microsoft Documentation.

C# is a very expansive language. And there is so much you can do with it.

There are so many jobs in C#

But if you wanted to learn more from me comment down below that you want to see an Intermediate Course.


Well. Upvote, feedback.


Works Cited

BillWagner. “C# Docs - Get Started, Tutorials, Reference.” Microsoft.Com, 2019,

“C# Tutorial - Tutorialspoint.” Www.Tutorialspoint.Com,

“C# Tutorial (C Sharp).” W3schools.Com, 2019,

Profile icon
Profile icon
Profile icon
Profile icon
Profile icon
Profile icon
Profile icon
Profile icon
Profile icon
Profile icon
Profile icon

Now this is the GOOD SH— stuff. The good stuff.

Profile icon

LOL! Yeah, I've dropped Assembly and moved on to C#. Might do Swift or F# after this dies down.


Profile icon
Profile icon

You evil spammer. One thing you forgot:

Profile icon

okay boomer


Profile icon

Add the fact that they return values, or dfkjghasghkljshfgkjadhfgkjdhskljdsfghldkjsghkljdfhgldjshgldkjs.

Profile icon

Oo Swift! I’ve been looking at it, and it’s a very interesting language idea at least...


Profile icon
Profile icon

Ya know I have an interesting little right up on n++ vs ++n in my repls somewhere....


Profile icon

don't you mean write-up?

Profile icon

Ye write-up lol sry bout that typo XD


Profile icon

sorry about being pedantic, i sometimes am

Profile icon

It’s perfectly fine, I am in fact seriously thankful for the catch, thank you. Lol.


Profile icon

did you just go from hello world to OOP in one tutorial?
i'm not interested in C# right now but this tutorial will help!
great work!

Profile icon

thank you!


Profile icon

Awesome!! Beste tutorial ever!! Waw


Profile icon

For the first one we aren't using "using System;" as a #include but more of a using namespace std.

Profile icon

Not really in depth. you just wrote n++ ++n you didn't even talk about incrementing after or before.

Profile icon


For those who don't know what's the diffrence.
If ++ is before the variable it means it will add before using the new value.
if ++ is used after the variable it will use the current value befor increasing it.

Profile icon

Hey nice! I guess this is pretty gud

Profile icon

this is cool.

i want an intermediate course.

Profile icon
Profile icon

i also want an f# tutorial

Profile icon

Nicely written. Now that C# has some attention, maybe will finally add .NET soon...

Profile icon

I’ve never really understood what .NET is... care to explain?


Profile icon

.NET has a bunch of built-in functions and stuff that speeds up the development process by a grand magnitude. The problem is, some functionality that other languages would call essential is locked in .NET, such as JSON, modern web requests, and GUI (although I doubt would implement WPF because of a lower demand). Sure, you could code that all by hand, and sure there are older libraries for some of those things, but either way there's still a lot of functionality we're missing without the .NET core.

Profile icon

So, .NET is like stdlib for c++...??? I think I’m still confused. :/


Profile icon

Not quite. We have a stdlib, but barely anything else.

Profile icon

Oh. Ok so then is it like an environment or something? Like you say it adds extensions, so is it like it makes it possible to use certain aspects of the Lang bc... agh.


Profile icon

If you understand what a DLL does, basically it's just a collection of a bunch of them that do a variety of tasks,

Profile icon

Ahhh ok I see now thank you :)


Profile icon

Hrmmm time for me to spend 2 hours on that only for it to fail
Eh I'll try anyways


Profile icon

I demand a CSGO hacking course with VMWARE and C#

Profile icon

, Why do you want to hack CounterStrikeGlobalOffensive

Profile icon

I have before. He seems to be knowledgeable about C# so game hacking won't be that hard for him.

Profile icon

, REALLY, COOL. My friend is like really good at CSGO. I wonder if he ever hacked

Profile icon

Been doing C# for 4 years now. F# is better though. And yes, I can hack CSGO with ease.


Profile icon

Good. as a note that you could add to the tutorial. C# exists because Java could be used on any OS which Microsoft did not like. So they made C# os dependent on what Windows ran on for the most part. And it just so happened that they had the same syntax and semantic styling.

Profile icon

, Lol Yeah.

Profile icon

lol you inspired me to finnally post my tutorial on basic cyber safety

Profile icon

Cool! Now I know how C#'s syntax works. now I can do Unity Better! Thanks a lot!

Profile icon

No problem :)