Beruflich Dokumente
Kultur Dokumente
C#
Programming
LESSON 3
ROMMEL L. DORIN
Contents
Operators
• Convert Method
Convert.ToInt32() method is only
that Convert.ToInt32() method
always accept the null value return
it. Hence the output is Zero.
3 ways to convert String
• Parse Method
Int32.Parse() method to convert the
length from string to int (32-bit
signed integer equivalent).
3 ways to convert String
• Parse Method
When we have a value greater
than Integer: If you assign the
value big value to string then it will
through an OverflowException as int
data type can’t handle the large
values (It very much depends upon
the range of data types).
3 ways to convert String
• Parse Method
When we have Empty String: If
you keep string blank then it will
through an exception System
Format Exception as the input is
blank.
3 ways to convert String
• TryParse Method
The difference in Parse() and TryParse()
method is only that TryParse() method
always return the value it will never
throw an exception.
3 ways to convert String
• TryParse Method
First of all it validate your string. If your
string is integer it returns True else False.
• TryParse Method
Decision Structure
! Not
&& AND
|| OR
Precedence of Operators
N Y
Print B Print A
Practice
Read
itemPrice1
Display “Enter
price of 2nd Display
item” totalPrice
Read
itemPrice2
STOP
A
Take Home Activity