Jump to content

C Sharp/Compilers

From Wikiversity
using System; 
class Program { 
    static void Main() { 
        char[] array = { 'z', 'a', 'b' }; // Convert array to a string and print it. 
        Console.WriteLine("UNSORTED: " + new string(array)); // Sort the char array. 
        Array.Sort<char>(array); 
        Console.WriteLine("SORTED: " + new string(array)); 
        
    } 
}

About Compiling

[edit | edit source]

Source code is really just a string of text. You can open most source code in any text editor (like Notepad, vim, textmate, etc) and view the code. The amazing part of the coding process is the compiler. The compiler takes the text that you've written and will convert it to machine code (in the case of languages such as C++) or an intermediary language that can be executed by a Just In Time Compiler (in the case of languages such as C# and Java). You could follow the lessons and learn the basics of the language from reading alone, but you'll need to get a copy of a compiler to run the code in the lessons.

Visual Studio - Windows only

[edit | edit source]

Visual Studio is the compiler and IDE created by Microsoft for Windows computers. Visual Studio has several versions. The professional version can compile C# code, as well as a number of other languages. However, this professional version is expensive. If you are a student you can obtain a free copy of Visual Studio 2008 Professional from Microsoft on their http://www.dreamspark.com(404 link) website.

The free alternative to Visual Studio Professional is Visual Studio Express Edition. Visual Studio Express Edition is perfect for learning how to code in C#, and can be obtained for free from Microsoft on their http://www.microsoft.com/express/vcsharp/ website. This is probably the best choice for learning C# on Wikiversity.

Microsoft offers three editions of Visual Studio: Community, Professional, and Enterprise. If you want to download Visual Studio to learn C#, the Community edition is a powerful IDE and free for personal use.

Visual Studio Code - Cross-Platform

[edit | edit source]

Visual Studio Code (VS Code) is a free, open-source code editor developed by Microsoft. It is lightweight, highly customizable, and supports a wide range of programming languages, including C#. VS Code is available on Windows, macOS, and Linux, making it a versatile choice for developers working across different platforms. This editor is quickly becoming an industry standard for hobbyists and professionals alike.

Key features of Visual Studio Code include:

  • Integrated Terminal: Run command-line tools directly within the editor.
  • Extensions: Enhance functionality with thousands of extensions available in the marketplace.
  • Debugging: Built-in debugging support for various languages.
  • Version Control: Integrated Git support for managing source code repositories.

To set up C# development in Visual Studio Code, you can install the C# extension from the Visual Studio Code Marketplace.

You can learn more about Visual Studio Code and download it for free from the Visual Studio Code website

JetBrains Rider - Cross-Platform

[edit | edit source]

JetBrains Rider is a powerful, cross-platform IDE designed for .NET development. It supports a wide array of applications targeting frameworks like .NET, ASP.NET Core, MAUI, and game engines like Unity, Unreal Engine, and Godot. Rider is known for its robust feature set and seamless integration with modern .NET technologies.

Key features of JetBrains Rider include:

  • Performance Profiling: Integrated tools for dynamic program analysis, monitoring, and profiling, making performance optimization a natural part of the development process.
  • Mixed Mode Debugging: Debug both .NET and C/C++ code in a single session, ideal for developers working with game engines or native Windows APIs.
  • Remote Development: Support for remote development on Windows, macOS, and Linux host machines via JetBrains Toolbox App.
  • Roslyn Syntax Tree Visualizer: Explore the structure of your C# code as a real-time syntax tree, interactively synchronized with the editor.
  • AI Assistant: AI-powered tooling for enhanced code completion, test generation, and offline support.

You can learn more about JetBrains Rider and download it from the JetBrains Rider website.

MonoDevelop - cross platform

[edit | edit source]

Mono is a project lead by Novell with goals to create a .NET compatible set of tools, including a compiler and Common Language Runtime (CLR). Mono is available as source for free, and can be compiled on Linux, BSD, UNIX, macOS, Solaris and Windows. It supports x86, SPARC, PowerPC, ARM, S390, x86_64, IA64 and SPARC processors. You can also get mono as a package for most operating systems. Mono can be downloaded at the http://www.mono-project.com/Main_Page website.

MonoDevelop is the accompanying IDE for the Mono Project. It is also available from source, and has many features that make it an easy to use compiler.

Where To Go Next

[edit | edit source]
Topics in C#
Beginners Intermediate Advanced
Part of the School of Computer Science