C Sharp Programming Language

From Free Knowledge Base- The DUCK Project: information for everyone
Jump to: navigation, search

The C# Programming Language, Kinda C-ish and from Microsoft. If you are familiar with C++ you should be able to adapt and learn C# (See-Sharp). Unlike C++, C# does not support multiple inheritance, although a class can implement any number of "interfaces" (fully abstract classes). This was a design decision by the language's lead architect to avoid complications and to simplify architectural requirements throughout CLI.

The C# programming language was designed by Anders Hejlsberg from Microsoft in 2000. Microsoft introduced C# along with .NET Framework and Visual Studio, both of which were closed-source. In 2004, a free and open-source project called Mono began, providing a cross-platform compiler and runtime environment for the C# programming language. Mono was originally by Ximian, it was later acquired by Novell, and is now being led by Xamarin, a subsidiary of Microsoft. Mono evolved from its initial focus of a developer platform for Linux desktop applications to supporting a wide range of architectures and operating systems. Unity3D embeds Mono.

Both Mono and .NET Core support GNU/Linux systems. A number of packages for Ubuntu, installable with Ubuntu's package manager from officially community-supported software sources, are written in C# and use Mono. This includes the music player Banshee, the notetaking app Tomboy, the raster graphics editor Pinta, and the password manager KeePass. Most text editors, such as Gedit, Vim, and Emacs, have syntax highlighting for C#. MonoDevelop and Visual Studio Code are two popular integrated development environments that run on Ubuntu and support C# development.

Microsoft first used the name C# in 1988 for a variant of the C language designed for incremental compilation which was never followed up nor completed. By design, C# is the programming language that tends to reflect the underlying Common Language Infrastructure (CLI). Most of its intrinsic types correspond to value-types implemented by the CLI framework. However, the language specification does not state the code generation requirements of the compiler: that is, it does not state that a C# compiler must target a Common Language Runtime, or generate Common Intermediate Language (CIL), or generate any other specific format.

Unlike C++, C# does not support multiple inheritance, although a class can implement any number of "interfaces" (fully abstract classes). This was a design decision by the language's lead architect to avoid complications and to simplify architectural requirements throughout CLI.

Need to install mono-mcs on linux

sudo apt install mono-mcs

Mono Compiler

mcs is the Mono C# compiler. The mcs compiler is used to compile against the latest Mono Base Class Library version and fully implements C# 1.0, 2.0, 3.0 and 4.0 specifications and it accepts the same command line options that the Microsoft C# compiler does.

Mono compiler: Hello World

vi helloworld.cs

Code

using System;

class HelloWorld {
  static void Main() {
    Console.WriteLine("Hello world");
  }
}

Compile with mcs

mcs -debug -out:hellow.exe helloworld.cs

Execute with mono runtime

mono hellow.exe