Quick reference guide to C#

Thursday, July 30, 2009

Quick referece guide to C# language
• In C# there are two kinds of variable types.
- Value Type (All value type variables are stored in stack)
- Reference Type (All reference type variables are stored in heap)
• We can use import keyword to import namespace which can be used to reference classes of that namespace in your class. We can assign the constant name to imported namespace also.
• To create new instance/object of class use new keyword.
• We can create read only and write only property in C# to extend member variables and objects.
• There are five kind of access modifier in C#.
- Private
- Public
- Protected
- Internal
- Protected Internal
• We can implement interface in c# two ways.
- Implicit (implement interface members without fully qualified name)
- Explicit (implement interface members with fully qualified name)
• Colon ( : ) is used to implement inheritance in class.
• The enum keyword used to declare an enumeration which can be numeric type only.
• In C# we can create one dimensional or multidimensional array.
• We can change the behavior of base class functionality in your child class by overriding (using override keyword) or hiding (using new keyword).
• We can access the base class functionality using base keyword.
• We can use try catch block for exception handling in our program.Structure of exception handling consists of three blocks.
1. try block
2. catch block
3. finally block (finally block will execute every time, whether exceptions occurs or not)
• In catch block we will catch any exceptions occurred during the executions of program in try block. We can use throw keyword inside a catch block to throw exceptions.
• There are three kind of error we face while working on our programs.
1. Syntax errors (compiler errors. Without fixing compiler errors we cannot move ahead in running application)
2. Run time errors (run time errors occurs when an expected operations are done on application) 3. Logical errors (logical errors occurs when application doesn’t work as per the business rules or functionality we have defined in the program)
• We use debug and trace class which allows us to trace and log message in application execution which can be useful in debugging the application.

0 comments:

Post a Comment

 
 
 
Your Ad Here