C# environment
In this chapter, we will discuss the tools needed to create C# programming. We have already mentioned that C# is .Net
part of the framework and used to write .Net
applications. So before we discuss thetools available to run C# programs, let’s take a look at the relationship between C# and the .net framework.
.Net
Framework
The .Net
framework is an innovative platform that can help you write thefollowing types of applications:
Windows application
Web application
Web service
.Net
framework applications are multi-platform applications. The framework is designed so that it can be used in the following languages: C #, C++, Visual Basic, Jscript, COBOL, and so on. All of these languages can access the framework and interact with each other.
.Net
framework consists of a huge code base for client languages such as C#. Here are some .Net
components of the framework:
Common Language Runtime - CLR
.Net
framework class libraryCommon language Specification
Common type system
Metadata and Assemblies
Windows Forms
ASP.Net and ASP.Net AJAX
ADO.Net
Windows Workflow Foundation
Windows Presentation Foundation
Windows Communication Foundation-WCF
LINQ
For more information about each component, please refer to Microsoft’s documentation.
C# Integrated Development Environment-IDE
Microsoft provides the following development tools for C # programming:
Visual Studio 2010 (VS)
Visual C# 2010 Express (VCE)
Visual Web Developer
The latter two are free to use and can be downloaded from the official Microsoft website. With these tools, you can write a variety of C# programs, from simple command-line applications to more complex applications. You can also write a C# source code file using a basic text editor, such as Notepad, and compile the code as a component using a command-line compiler (part of the .NET Framework).
The Visual C# Express and Visual Web Developer Express versions are customized versions of Visual Studio and have the same look and feel. They retain most of the functions of Visual Studio. In this tutorial, we are using Visual C# 2010 Express.
You can download it from Microsoft Visual Studio. It will be automatically installed on your machine. Please note that you need an available network connection to complete the express version installation.
Write C# programs on Linux or Mac OS
Although .NET
framework runs on the Windows operating system, but thereare some versions that run on other operating systems to choose from. Mono
is an open source version of .NET
framework that contains a C#compiler and runs on a variety of operating systems, such as various versions of Linux and Mac OS. For more details, please visit Go Mono.
The goal of Mono
is not just to run Microsoft across platforms .NET
applications, but also provide better development tools for Linux developers. Mono
runs on a variety of operating systems, including Android, BSD, iOS, Linux, OS X, Windows, Solaris, and UNIX.
sudo apt install mono-devel
How to run:
Old version:
$ dmcs --version
Note: dmcs is deprecated, please use mcs instead!
Mono C# compiler version 6.8.0.105
Using mcs command:
mcs csharp_src_file.cs