Custom Class with Constructor - C# Typing CST Test
Loading…
Custom Class with Constructor — C# Code
Defines a class with a constructor and uses it to initialize properties.
using System;
public class Book {
public string Title { get; set; }
public string Author { get; set; }
public Book(string title, string author) {
Title = title;
Author = author;
}
}
class Program {
static void Main() {
Book book = new Book("1984", "George Orwell");
Console.WriteLine($"{book.Title} by {book.Author}");
}
}C# Language Guide
C# (C-Sharp) is a modern, object-oriented, multi-paradigm programming language built by Microsoft for the .NET platform. It is designed for productivity, type safety, performance, and building scalable applications across desktop, web, mobile, gaming, and cloud systems.
Primary Use Cases
- ▸Enterprise backend systems
- ▸Web APIs (ASP.NET Core)
- ▸Unity game development
- ▸Desktop software (WPF/WinUI)
- ▸Cloud-native microservices on Azure
- ▸Cross-platform mobile apps (MAUI/Xamarin)
Notable Features
- ▸Strongly-typed OOP design
- ▸Async/await built-in
- ▸LINQ for querying data
- ▸Cross-platform runtime via .NET Core
- ▸Modern functional programming features
- ▸Powerful tooling with Visual Studio
Origin & Creator
Created by Anders Hejlsberg at Microsoft in 2000 as part of the .NET platform. Evolved significantly with versions introducing LINQ, async/await, records, pattern matching, and high-performance features in modern .NET.
Industrial Note
C# dominates Windows development, enterprise CRM/ERP systems, Unity-powered games, Azure cloud apps, and scalable backend systems. It is widely chosen for large corporate software ecosystems, cloud-native microservices, and cross-platform applications through .NET Core.