C# (pronounced “C-sharp”) is a modern, object-oriented programming language developed by Microsoft. It is a member of the C family of languages, which also includes C, C++, and Java.
No. | Title |
---|---|
1 | C# / C Sharp |
2 | Advantages and Disadvantages |
3 | Usage |
4 | Syntax |
5 | Example |
C# is designed to be simple, powerful, and expressive, and it is used to build a wide variety of applications, including Windows desktop applications, web applications, mobile apps, games, and more. Some of the key features of C# include:
C# is primarily used for developing Windows desktop applications, web applications, and mobile apps. Some of the popular applications that use C# include:
Windows Forms and WPF (Windows Presentation Foundation) applications: C# is commonly used for building traditional desktop applications that run on Windows.
ASP.NET web applications: C# is used to build server-side web applications using the ASP.NET framework.
Xamarin mobile apps: C# can be used to build cross-platform mobile apps for iOS and Android using the Xamarin framework.
Unity game development: C# is a popular language for developing games with the Unity game engine.
Internet of Things (IoT) and Embedded Systems: C# can be used to develop IoT and embedded systems applications using the .NET Micro Framework.
Azure Cloud: C# can be used to develop applications that run on Microsoft Azure, a cloud computing platform and infrastructure created by Microsoft.
C# syntax is similar to other C-style languages such as C, C++, and Java. Some of the key elements of C# syntax include:
C# syntax is similar to other C-style languages such as C, C++, and Java. Some of the key elements of C# syntax include:
using System;
class Rectangle
{
// properties
public double Length { get; set; }
public double Width { get; set; }
// method to calculate the area of the rectangle
public double GetArea()
{
return Length * Width;
}
}
class Program
{
static void Main(string[] args)
{
Rectangle rect = new Rectangle();
rect.Length = 5;
rect.Width = 10;
Console.WriteLine("The area of the rectangle is: " + rect.GetArea());
}
}