Thursday, February 27, 2014

Boxing & UnBoxing

Boxing and Unboxing

  • Boxing: Converting a variable value into "Object" type value implicitly.
  • Unboxing:  Converting  the  "Object"  type  value  into  variable  explicitly  (using conversion                                 methods).

 Download above Code of Demo on Boxing and UnBoxing : Downloads Links

Variable Scopes

  • A "variable scope" simply is something, which decides the lifetime of the variable.
  • The variable scope depends on the place, where the variable is declared in the program.
  • For  example,  a  variable  is  declared  in  ―if‖  block,  is  available  only  within  the  "if"  block itself.
  • To have a better idea on this, we discuss about all available scopes in C#.

Strong  Rule  to  follow:    
     Multiple  variables  with  same  name  within  the  same  scope can‘t be declared anywhere.

Operators

C# supports different kinds of operators.
  • Assignment operator
                  =
  • Arithmetical / Mathematical operators
            +, -, *, /, %
  • Self Assignment operators
           +=, -=, *=, /=
  •  Prefix and Postfix operators
            ++, --
  • Relational operators
           ==, !=, <, >, <=, >=
  • Logical operators
           &&, ||, !
  • Comment operators
            //xxxxxxxxxxxxxx
             (or)
            /* xxxxxxxxxxx
            xxxxxxxxxxx
            xxxxxxxxxxx*/
  • Concatenation Operator
            +
  • Block specification operators
           { }
  • Method specification operators
           ( )
  • Conditional operator
          ? :
  • Dynamic memory allocation operator
            new

Operator Procedence




No comments:

Post a Comment

Flag Counter