0% found this document useful (0 votes)
6 views8 pages

Csharp

This document is a comprehensive guide to C# covering both fundamental and advanced concepts. It includes sections on basic syntax, data types, object-oriented programming, collections, exception handling, and asynchronous programming, among others. Additionally, it touches on advanced topics such as generics, reflection, and design patterns.

Uploaded by

my Udaipur
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views8 pages

Csharp

This document is a comprehensive guide to C# covering both fundamental and advanced concepts. It includes sections on basic syntax, data types, object-oriented programming, collections, exception handling, and asynchronous programming, among others. Additionally, it touches on advanced topics such as generics, reflection, and design patterns.

Uploaded by

my Udaipur
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Here’s a detailed C# notes guide covering the fundamentals and some

advanced concepts, structured for easy understanding:

1. Introduction to C#

Developed by: Microsoft

Platform: .NET Framework / .NET Core / .NET 5+

Type: Object-Oriented Programming Language

File extension: .cs

2. Basic Syntax

Using System;

Namespace HelloWorld {

Class Program {

Static void Main(string[] args) {

Console.WriteLine(“Hello, World!”);

}
}

3. Data Types

Value Types: int, float, double, bool, char, decimal

Reference Types: string, object, class, interface

Nullable Types: int?, double?

4. Variables and Constants

Int age = 25;

Const double PI = 3.14159;

5. Operators

Arithmetic: + - * / %
Comparison: == != > < >= <=

Logical: && || !

Assignment: = += -= *= /=

6. Control Statements

Conditional: if, else if, switch

Looping: for, while, do-while, foreach

Jump: break, continue, return

7. Object-Oriented Concepts

Class and Object

Class Car {

Public string color;

Public void Drive() {


Console.WriteLine(“Driving…”);

Car car = new Car();

Encapsulation

Using access modifiers (public, private, protected, internal)

Using getters and setters

Inheritance

Class Vehicle {

Public void Start() => Console.WriteLine(“Starting”);

Class Bike : Vehicle {

Public void Ride() => Console.WriteLine(“Riding”);

Polymorphism

Compile-time: Method Overloading

Run-time: Method Overriding


Abstraction

Using abstract classes and interfaces

8. Interfaces

Interface IShape {

Void Draw();

Class Circle : IShape {

Public void Draw() => Console.WriteLine(“Drawing Circle”);

9. Collections

Array: int[] arr = new int[5];

List<T>, Dictionary<K,V>, Queue<T>, Stack<T>

LINQ for querying collections


10. Exception Handling

Try {

Int x = 5 / 0;

Catch (DivideByZeroException ex) {

Console.WriteLine(ex.Message);

Finally {

Console.WriteLine(“Done”);

11. File I/O

Using System.IO;

File.WriteAllText(“file.txt”, “Hello File”);

String text = File.ReadAllText(“file.txt”);

12. Delegates and Events


Delegate: type-safe function pointer

Public delegate void MyDelegate(string message);

MyDelegate del = Console.WriteLine;

Del(“Hello”);

Event: wrapper around delegates for pub-sub pattern

13. LINQ (Language Integrated Query)

Var result = from n in numbers

Where n > 5

Select n;

14. Asynchronous Programming

Async Task<int> GetDataAsync() {

Await Task.Delay(1000);

Return 42;

}
15. Advanced Topics

Generics

Attributes

Reflection

Dependency Injection

Entity Framework

ASP.NET Core MVC

Design Patterns (Singleton, Factory, etc.)

Would you like a PDF version, topic-wise breakdown, or code examples for
each section?

You might also like