Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Net Framework
Software Framework
Two pieces of it
CLR n FCL
(SHOLM)
Memory Management
Security
OS and HW independence
Language Independence
Visual Studio:
IDE: goal of an IDE to put all tools and functionality that u need to build application
in one place
Statement:
Statement is an instruction
Method is a series of statements
Statement end with semicolons
Statements are executed in the order they appear
Expressions:
Expressions are statements that produce a value
Int x=5;
Operators: CERMA
Mathematical Operators: ( +, -, x, /)
Relational: (<, >, <=, >=)
Equality: (= =, ! =)
Conditional: (&&, 11)
Assignment: (=, +=, -=, x=, /=)
Constructor:
Special method to create objects
Set default values
Multiple constructors allowed but overload methods must take different arguments
Inheritance
Encapsulation
Polymorphism
Encapsulation
Access Modifier: AM are keywords that allow you to achieve encapsulation
Static
Static class can have only static members. Can’t instantiate a static class
Sealed:
Sealed classes can’t be instantiated. Prevent extensibility or misuse#
Some framework classes are sealed for performance and security implications
Method Parameters
Parameters pass by value
Reference types pass a copy of the reference
Value types pass a copy of the value
Parameter keywords
Ref (we are going to used it inside method) and out keywords allow pass “by
reference”
Enumeration:
A set of named constants. Integer is default data type. By default number starts from
zero.
Interfaces:
An interface defines group of related methods, properties, and events
No implementation defined in interface
All members are public
Classes and structures can inherited from interface and provide implementation
Classes and structures can inherit from multiple interfaces
Members
Methods:
Methods define behaviour
Every method has zero or more parameters
Use params keyword to accept a variable number of parameters(if u don’t know no of
parameters)
Every method has signature( method name + parameters)
Methods overloading:
Define multiple methods with the same name but a unique signature
Fields:
Fields are variable of a class
Delegates:
A delegate is a type that references methods
Similar to a function pointer, but type safe
Subscribing to events:
Use += and -= to attach or detach events handlers
This keyword:
This always represent the current instance of the class
Static properties and static method always invoked through type name.
Instance method and properties are invoked through object instance.
Indexers:
Enables indexing of an object(like an array)
Operator overloading
We can overload most unary and binary operators
+ - * / ++ -- = = <>
Overload using static methods
Conversion Operator
Convert an object from one type to another
implicit or explicit( cast type) conversion operator
Destructor:
Destructor is used to clean up an object instance
Can not overload class destructor
Can not explicitly invoked destructor
C Sharp Flow
If Statement
If statement selects a statement for execution based on some provided Boolean value
Switching