C# (pronounced "C-Sharp") is a modern, powerful and versatile object-oriented programming language developed by Microsoft that is widely used for various types of applications. It is designed to run on the .NET Framework and is known for its simplicity, versatility.
C# is a multi-paradigm language that supports various programming styles, including structured, imperative, object-oriented, event-driven, task-driven, functional, generic, reflective, and concurrent programming. This flexibility makes C# suitable for a wide range of applications, including:
-
Mobile applications: C# can be used to develop apps for iOS and Android using frameworks like Xamarin.
-
Desktop applications: It is commonly used for building Windows applications.
-
Web applications and services: C# is widely used for developing web applications and services using ASP.NET.
-
Games: C# is the primary language for Unity, a popular game development engine.
-
VR applications: C# is also used in virtual reality development.
-
Database applications: It is used for creating applications that interact with databases.
| Folder | Description |
|---|---|
01_hello_world |
Create a basic console app; Main method and Console.WriteLine. |
02_output |
Write and format text with Console.Write/WriteLine and escape sequences. |
03_variables |
Declare variables, choose types, naming, and scope basics. |
04_constants |
Use const (and readonly fields) for immutable values. |
05_type_casting |
Implicit/explicit casts, Parse/TryParse, and Convert methods. |
06_user_input |
Read input with Console.ReadLine and safely parse to types. |
07_arithmetic_operators |
+, -, *, /, %, ++, --, precedence and numeric types. |
08_math_class |
Use Math methods: Abs, Pow, Sqrt, Round, Floor, Ceiling, Max/Min. |
09_random_numbers |
Generate random ints/doubles with Random and understand seeding. |
10_hypotenuse_calculator_program |
Compute triangle hypotenuse using Pythagorean theorem and Math.Sqrt. |
11_string_methods |
Common string ops: Length, Trim, ToUpper/Lower, Contains, IndexOf, Substring, Replace. |
12_if_statements |
Control flow with if/else if/else and block scope. |
13_switches |
Use switch statements (and basic switch expressions) for branching. |
14_logical_operators |
Boolean logic with &&, |
15_while_loops |
Iterate with while and do-while; loop conditions and breaks. |
16_for_loops |
Counted loops, continue/break, and loop variables. |
17_nested_loops |
Loops inside loops; building grids and patterns. |
18_number_guessing_game |
Guessing game with Random, loops, and conditional hints. |
19_rock_paper_scissors_game |
Implement game logic, input handling, and result evaluation. |
20_calculator_program |
Simple calculator using operators, switch, and error checks. |
21_arrays |
One-dimensional arrays: declare, initialize, index, and Length. |
22_foreach_loop |
Iterate collections safely with foreach; read-only iteration variable. |
23_methods |
Define methods, parameters, return types, and scope. |
24_return_keyword |
Return values and early exits; void vs non-void methods. |
25_method_overloading |
Multiple methods same name with different parameter lists. |
26_params_keyword |
Variable-length argument lists using params arrays. |
27_exception_handling |
try/catch/finally, specific exceptions, and throw new Exception. |
28_conditional_operator |
Ternary operator ? : for concise conditional expressions. |
29_string_interpolation |
$"..." interpolation, format specifiers, and culture considerations. |
30_multidimensional_arrays |
Rectangular [,] vs jagged arrays []; traversal and initialization. |
31_classes |
Class syntax, fields, methods, access modifiers, and encapsulation. |
32_objects |
Instantiate with new, references vs values, and null handling. |
33_constructors |
Define constructors, overloads, default values, this()/base() chaining. |
34_static |
Static fields/methods, static classes, and static constructors. |
35_overloaded_constructors |
Multiple constructors and chaining to reduce duplication. |
36_inheritance |
Derive classes, base keyword, virtual members, and reuse. |
37_abstract_classes |
Abstract classes/methods and required overrides in subclasses. |
38_array_of_objects |
Arrays of custom types; initialization and iteration patterns. |
39_objects_as_arguments |
Pass objects to methods; reference semantics, ref/out basics. |
40_method_overriding |
Override virtual methods; sealed overrides and base calls. |
41_ToString_method |
Override ToString for readable object representations. |
42_polymorphism |
Runtime polymorphism via virtual/override and interfaces. |
43_interfaces |
Define/implement interfaces; multiple inheritance of contracts. |
44_Lists |
List basics: Add, Remove, index, Count, and search. |
45_List_of_objects |
Manage lists of custom objects; predicates and LINQ queries. |
46_getters_and_setters |
Properties with get/set, backing fields, and validation. |
47_auto_implemented_properties |
Shorthand properties, init-only setters, and defaults. |
48_enums |
Define enums, underlying types, and [Flags] for bit fields. |
49_generics |
Generic types/methods, constraints (where T : ...), and type safety. |
50_multithreading |
Threads, ThreadPool, tasks, synchronization (lock), and race conditions. |
To run these projects, you can simply use the Python code from each folder and run it on any IDE you prefer.
-
Clone the repository to your local machine:
git clone https://github.com/your-username/your-repository-name.git
-
Navigate to any C# folders, for example:
cd your-repository-name/01_hello_world/Program.cs -
Open the terminal in Visual Studio by pressing Ctrl+ (backtick) and run the following command to compile your code:
cd C:\Path\To\YourProject msbuild Program.cs
Feel free to fork this repository and submit your own C++ projects or improvements via pull requests!
This project is licensed under the MIT License - see the LICENSE file for details.
