0% found this document useful (0 votes)
2 views4 pages

CSharp Detailed Notes

C# is an object-oriented programming language developed by Microsoft that runs on the .NET framework, used for various applications including web and desktop apps. Key concepts include basic syntax, data types, control statements, object-oriented programming principles, and exception handling. Additional topics cover file handling, collections, LINQ, delegates, events, and useful tools for development.

Uploaded by

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

CSharp Detailed Notes

C# is an object-oriented programming language developed by Microsoft that runs on the .NET framework, used for various applications including web and desktop apps. Key concepts include basic syntax, data types, control statements, object-oriented programming principles, and exception handling. Additional topics cover file handling, collections, LINQ, delegates, events, and useful tools for development.

Uploaded by

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

C# Programming Notes (Detailed)

1. Introduction to C#
- C# is an object-oriented programming language developed by
Microsoft.
- It runs on the .NET framework.
- C# is used to develop web apps, desktop apps, games, and more.

2. Basic Syntax
- Every C# program must contain a Main method:
static void Main(string[] args) { ... }
- Statements end with a semicolon `;`
- Curly braces `{}` define blocks of code.

3. Data Types
- int, float, double, char, string, bool
- Example: int x = 10;

4. Variables and Constants


- Variables store data. Must declare before use.
- Constants: `const int MAX = 100;`

5. Operators
- Arithmetic: + - * / %
- Comparison: == != > < >= <=
- Logical: && || !
6. Control Statements
- if, else if, else
- switch-case
- Loops: for, while, do-while, foreach

7. Arrays and Strings


- Arrays: int[] arr = new int[5];
- Strings: string name = "Hello";

8. Functions (Methods)
- Methods allow code reuse.
- Example:
int Add(int a, int b) {
return a + b;
}

9. Object-Oriented Programming
- Class: Blueprint for objects.
- Object: Instance of class.
- Concepts: Inheritance, Polymorphism, Encapsulation, Abstraction

10. Constructors and Destructors


- Constructor: special method called when object is created.
- Destructor: used for cleanup (rarely used in modern C#).

11. Exception Handling


- try { ... } catch(Exception e) { ... } finally { ... }
12. File Handling
- Use System.IO namespace
- File.ReadAllText(), File.WriteAllText()

13. Collections
- List<T>, Dictionary<K,V>, Stack<T>, Queue<T>
- Example: List<int> nums = new List<int>();

14. LINQ (Language Integrated Query)


- Query data using SQL-like syntax.
- Example: var result = from n in nums where n > 10 select n;

15. Delegates and Events


- Delegate: reference type that refers to methods.
- Events: used in GUI apps for handling actions.

16. Namespaces
- Used to organize code.
- Example: using System;

17. Access Modifiers


- public, private, protected, internal

18. Static vs Instance


- Static: shared by all instances.
- Instance: belongs to object.
19. Interfaces and Abstract Classes
- Interface: defines method signature only.
- Abstract class: can have both abstract and concrete methods.

20. Useful Tools


- IDE: Visual Studio, VS Code
- .NET CLI: dotnet new, dotnet run

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy