C#

Purely object oriented language that relies on a JIT. Primary library is .NET

C# is both portable and fast, and coupled with the .NET framework.

Types

Modifiers

casting

casting works the same way as C/C++

Or call convert

strings

operators

ArrayList

ArrayList friends = new ArrayList();
friends.Add("Bob");
friends.Add("Mike");

Exceptions

    try {
        int division = 10 / Convert.ToInt32(Console.ReadLine());
    } catch(DivideByZeroException e) {
        Console.WriteLine(e);
    } catch(Exception e){
        Console.WriteLine($"Unkown Error: {e}");
    }
throw new DivideByZeroException("Cant add that... My Custom error is here");

Constructors

Called at creation of class, same as C/C++ constructors.

this.xyz is also valid.

Abstraction

declare a class as abstract.

To override a class add the modifier override.

interface

An interface is a fully abstract class that can be inherited by other classes. It provides some set functions to be implimented by the child class.

    public interface Animal{
        void Speak();
    }

    public class Dog : Animal {
        public void Speak(){
            Console.WriteLine("Woof Woof");
        }
    }

    public class Cat : Animal {
        public void Speak(){
            Console.WriteLine("Meow");
        }
    }

See interface

Examples

Hello World

class Application
{
    public static void Main(string[] args)
    {
        Console.WriteLine("Hello world!");
    }
}

ASP.NET

See ASP.NET

.NET

see dotnet

index