Variables and Data types          Programming in C#             tnngo2@gmail.com
Using variables      Memory is allocated to a variable at the time of its creation.      Syntax:                <datatype>...
Data Types      Value Types              store actual values.              the values are stored              in stack.   ...
Classification       Object       String       Class       Delegate       Interface       Array
Rules        Recommended CAMELCASE              int totMonths = 12
Question?
Question?
Comments and XML Documentation
Definition      Single-line Comments      Multi-line Comments      XML Comments
XML Documentation
Predefined XML Tags
Constants and Literals
Constants      possible to declare constants for all data types.      have to initialize a constant at the time of its dec...
Using Literals       A literal is a static value assigned to variables and constants.       Numeric literals might suffix ...
Keywords and Escape Sequences
Keywords
Escape Sequence Characters
Input and Output
Console Operations      are tasks performed on the command line interface.      All console application consist of three s...
Output Methods     Console.Write()     Console.WriteLine()
Placeholders
Input Methods     Console.Read()     Console.ReadLine()
Convert Methods
Numeric Format Specifiers      Console.WriteLine(“{format specifier}, <variable name>”);
Numeric Format Specifiers
Standard Date and Time Format Specifiers
Standard Date and Time Format Specifiers
Question     What is result of following code snippet?
2   variables and data types
Upcoming SlideShare
Loading in …5
×

2 variables and data types

1,097 views
1,041 views

Published on

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,097
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
31
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

2 variables and data types

  1. 1. Variables and Data types Programming in C# tnngo2@gmail.com
  2. 2. Using variables Memory is allocated to a variable at the time of its creation. Syntax: <datatype> <variableName>; int empNumber; empNumber = 100; string empName = “M. Nolan”;
  3. 3. Data Types Value Types store actual values. the values are stored in stack. int, float, double, … Reference Types store the memory address of other variables in heap string, class
  4. 4. Classification Object String Class Delegate Interface Array
  5. 5. Rules Recommended CAMELCASE int totMonths = 12
  6. 6. Question?
  7. 7. Question?
  8. 8. Comments and XML Documentation
  9. 9. Definition Single-line Comments Multi-line Comments XML Comments
  10. 10. XML Documentation
  11. 11. Predefined XML Tags
  12. 12. Constants and Literals
  13. 13. Constants possible to declare constants for all data types. have to initialize a constant at the time of its declaration. The compiler identify constants at the time of compilation
  14. 14. Using Literals A literal is a static value assigned to variables and constants. Numeric literals might suffix with a letter of the alphabet to indicate the data type of the literal. Boolean => bool Integer => int, uint (u), long (l), ulong (ul or lu) long val = 53L; Real => float(f), double(d), decimal(m) float val = 1.66f; Character String => regular or verbatim. Null
  15. 15. Keywords and Escape Sequences
  16. 16. Keywords
  17. 17. Escape Sequence Characters
  18. 18. Input and Output
  19. 19. Console Operations are tasks performed on the command line interface. All console application consist of three streams Standard in Standard out Standard err
  20. 20. Output Methods Console.Write() Console.WriteLine()
  21. 21. Placeholders
  22. 22. Input Methods Console.Read() Console.ReadLine()
  23. 23. Convert Methods
  24. 24. Numeric Format Specifiers Console.WriteLine(“{format specifier}, <variable name>”);
  25. 25. Numeric Format Specifiers
  26. 26. Standard Date and Time Format Specifiers
  27. 27. Standard Date and Time Format Specifiers
  28. 28. Question What is result of following code snippet?

×