What is "c#"
C# (csharp) is a multi-paradigm language, managed, statically and strongly tipada, created by Microsoft in conjunction with .net Framework. C# can also be used in third-party systems with the help of platforms, such as Mono.
1.0/1.2 and 2.0 versions of C# have been submitted and approved in the standards ECMA and ISO/IEC. However, as of August 2013, there are no ECMA or ISO/IEC specifications for C# 3.0, 4.0 and 5.0, however language specifications are available in Microsoft for C# 3.0 and C# 5.0.
The language type system is essentially static, and only declared variables are allowed. However, the introduction of var (C# 3.0) and Dynamic (C# 4.0) allowed it to use type inference while maintaining static typing with var and allowing interaction with dynamic type systems using Dynamic to delay type checking for execution.
Delegates (especially with the support of lexical closures for anonymous methods (C# 2.0) and lambda expressions (C# 3.0)) allow the language to be used for functional programming. C# 5.0 introduced the async and await to simplify the use of asynchronous function calls.
Generics are present in C#, partially in Runtime, as opposed to C++ templates (templates are solved at compile time), or Generics Java (which use type deletion or type Erasure).
The compilation is usually done for the Common Intermediate Language (CIL), which is then compiled into native (and cached) code while running the Common Language Runtime (CLR) through the compiler Just-In-Time (JIT). However, options such as Ngen (for Microsoft .NET Framework ) and AOT (for Mono) allow the C# code to be directly compiled to the native image. Also, some Frameworks (for example, the . NET Micro Framework) act as CIL interpreters, without JIT.
The language is available for a wide range of platforms. The Microsoft . NET enables development for Windows Desktop, Windows Store Apps, web, Xbox, Windows Phone. Along with Mono (desktops, servers, mobile devices), Silverlight / Moonlight (browsers, mobile devices), Compact Framework (mobile devices) and Micro Framework (embedded devices).
Hello World example
class Hello {
static void Main() => System.Console.WriteLine("Hello world!");
}
A more complete example:
using static System.Console;
namespace HelloWorldUsingClasses {
class ExampleClass {
string exampleString = "Hello World!";
public ExampleClass() {
Console.WriteLine(exampleString);
}
}
class Program {
static void Main(string[] args) {
ExampleClass objHelloWorld = new ExampleClass();
}
}
}
C# 6 resources
C# 7 resources
Learning Resources
Where to learn more about C#.
Books
[Iniciante]
Use the Head! C#[Iniciante]
C# How to Program[Intermediário]
Programming C# 3.0[Intermediário]
Professional C# and Platform . NET 4[Avançado]
Dominating the C# Background
Resources
Problem Sites for Student Resolution
- Topcoder
- Codejam
- USACO Training Program
- Codechef
- Sphere Online Judge
- Timus Online Judge
- Projecteuler
MS related certifications
[70-483]
Guide to Certification 70-483
Online Editors of C#
Editors Offline de C#
We have questions here that we can consider as canonical and reading them will learn a lot of what you need to solve your problem:
- How do I remove accents in a string?
- What’s the difference between Struct and Class?
- When to use var in C#?
- What are lambda Expressions? And what’s the point of using them?
- Differences between Parse vs Tryparse
- What is the difference of string vs string?
- What is the meaning of the operator "??"
- Which means the "@" sign on C#?
- What is the use of the reserved word "Yield"?
- How namespaces work in C#?
- Difference between the use of typeof and is
- Differences between If and ternary operator ?:
- Using unused affect performance?