Skip to content

Instantly share code, notes, and snippets.

@kironroy kironroy/csharp.md
Created Jul 12, 2019

Embed
What would you like to do?
C# Wiki

c sharp logo


Kiron Roy's DEV Profile

Console Programs on Repl.it


C# GitHubRepositories


Notes

Static Classes = one copy for the entire lifetime of the application. Storing data inside a static class is not a good idea, because it increases the application's memory footprint. They aren't instantiated (look below)

Instantiated Classes

Auto Properties = are more common because auto-properties target many types of applications WinForms, WPF, ASP.NET MVC...

Constructor = (ctor) is a method that is not static. It is part of the instantiated class. A constructor is a special type of method when a "car/house" (object) is built.

Method overloading

Extension Methods

Inheritance

Interface

Abstract Classes

Abstract Classes and Interface


C# Introduction


ASP.NET Websites


Articles


Troubleshooting


Meetups


Stack and Heap


Programming Features Help


Algorithms


Console Games

IOT (Internet of Things)


Open Source


Tools


Topics

Scope

Control Flow

Arrays and Lists

Strings

DateTime

Enums

Strings

Procedural

OPP

Additional Topics


c sharp logo

C# Repl

> #r "C:\Users\yourusername\source\repos\BirdWatcher\BirdWatcher\BirdWatcher.dll" = your project will be linked to C# Interactive (REPL)

Code Snippets

Control + Shift N = start a new project

Alt UP ARROW / DOWN ARROW = move a single or multiple lines of code up or down

control + j = brings back intellisense

control + x = cut a single line

control + kc = // comment several lines out

control + . = // using System ...

control + k = uncomment several lines out

shift + tab = unindent lines of code

control shift b = complie (build)

control shift d = copy and past previous line

cw + tab tab = Control.WriteLine() (press tab twice)

try tab = try block created (works for if, while, do, for and foreach statements as well)

ctor = Makes a constructor

prop + tab tab = declare auto-properties

propfull + tab tab = declare full on properties

control + tab = get back to another file

type /// private static void addTwoNumbers ... = add /// <summary> comments </summary>

Control R + R = change name of a class

Control . = Recognize a class from another namespace

Control R, A = run test

mvcaction4 + tab = create a ActionResult (MVC)

In case mvcaction4 snippet does not work click here

Debugging

F9 = add break point

F5 = run in debug mode

F10 = step over

Shift + F11 = step out of

Shift + F5 = exit debug mode

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.