SlideShare a Scribd company logo
Type Casting C# - Lec4 (Workshop on C# Programming: Learn to Build)
C#
Day 1
Lecture5: Type Casting
Type Casting
using System;
namespace dataType
{
class Program
{
static void Main(string[] args)
{
int a = 1;
int b = 2;
short result = (short) (a + b);
Console.WriteLine(result);
Console.Read();
}
}
}
Type Casting
using System;
namespace dataType
{
class Program
{
static void Main(string[] args)
{
string String1 = "123";
int a = Int32.Parse(String1);
Console.WriteLine(a);
Console.Read();
}
}
}
Type Casting
using System;
namespace dataType
{
class Program
{
static void Main(string[] args)
{
string String1 = "123";
string String2 = "321";
int c = Int32.Parse(String1) + Int32.Parse (String2);
Console.WriteLine(c);
Console.Read();
}
}
}
Type Casting
using System;
namespace dataType
{
class Program
{
static void Main(string[] args)
{
string String2 = "321";
int b = Convert.ToInt32(String2);
Console.WriteLine(b);
Console.Read();
}
}
}
Type Casting
using System;
namespace dataType
{
class Program
{
static void Main(string[] args)
{
string String1 = "123";
string String2 = "321";
int c = Convert.ToInt32 (String1) + Convert.ToInt32(String2);
Console.WriteLine(c);
Console.Read();
}
}
}
Type Casting
using System;
namespace dataType
{
class Program
{
static void Main(string[] args)
{
string String1 = "123";
string String2 = "321";
int c = Int32.Parse.ToInt32 (String1) + Convert.ToInt32(String2);
Console.WriteLine(c);
Console.Read();
}
}
}
Type Casting
using System;
namespace dataType
{
class Program
{
static void Main(string[] args)
{
double d = 123.998;
int e = (int)d;
Console.WriteLine(e);
Console.Read();
}
}
}
Type Casting
using System;
namespace dataType
{
class Program
{
static void Main(string[] args)
{
string String1 = "123";
int a = Int32.Parse(String1);
object obj = a;
int r = (int)obj;
Console.WriteLine(r);
Console.Read();
}
}
}
This slide is provided as a course material in the workshop named
“Workshop on C# Programming: Learn to Build”.
Organized by-
East West University Computer Programming Club (EWUCoPC)
Prepared by-
Jannat Binta Alam
Campus Ambassador
Young Engineers Society (YES)
E-mail: jannat.cse.ewu@gmail.com

More Related Content

PPTX
C# Basic - Lec1 (Workshop on C# Programming: Learn to Build)
PPTX
Data Type C# - Lec2 (Workshop on C# Programming: Learn to Build)
PPTX
32sql server
PPT
Python advanced 3.the python std lib by example –data structures
PPTX
Net framework
PPTX
Tools for reading papers
PPTX
Understanding the components of standard template library
PPT
Python advanced 3.the python std lib by example – algorithm
C# Basic - Lec1 (Workshop on C# Programming: Learn to Build)
Data Type C# - Lec2 (Workshop on C# Programming: Learn to Build)
32sql server
Python advanced 3.the python std lib by example –data structures
Net framework
Tools for reading papers
Understanding the components of standard template library
Python advanced 3.the python std lib by example – algorithm

What's hot (19)

PDF
Reactive Programming in the Browser feat. Scala.js and PureScript
PDF
(Kpi summer school 2015) theano tutorial part1
PPT
2CPP16 - STL
PPTX
Theano tutorial
PPTX
Constructor and destructor
PDF
An Introduction to the C++ Standard Library
PPT
Python advanced 3.the python std lib by example – application building blocks
PDF
Building a Tagless Final DSL for WebGL
PPTX
Machine Learning in H2O
PDF
Cocoaheads Meetup / Alex Zimin / Swift magic
PPTX
Operators and expression in c++
PPTX
Stack Data structure
DOCX
Exp 6.1 d-422-1
PPTX
Streams&io
PPT
Playing the toStrings
PPTX
Pa2 session 1
PPTX
An introduction to java programming
PPTX
CSharp for Unity - Day 1
Reactive Programming in the Browser feat. Scala.js and PureScript
(Kpi summer school 2015) theano tutorial part1
2CPP16 - STL
Theano tutorial
Constructor and destructor
An Introduction to the C++ Standard Library
Python advanced 3.the python std lib by example – application building blocks
Building a Tagless Final DSL for WebGL
Machine Learning in H2O
Cocoaheads Meetup / Alex Zimin / Swift magic
Operators and expression in c++
Stack Data structure
Exp 6.1 d-422-1
Streams&io
Playing the toStrings
Pa2 session 1
An introduction to java programming
CSharp for Unity - Day 1
Ad

Similar to Type Casting C# - Lec4 (Workshop on C# Programming: Learn to Build) (20)

DOCX
Dotnet 18
DOCX
DOCX
csharp dot net codes for practical examination
DOCX
.net progrmming part3
PDF
C# Lab Programs.pdf
PDF
C# Lab Programs.pdf
PPT
Attributes & .NET components
PPTX
C#.net
DOCX
.net progrmming part2
PDF
delegates
PPT
TechTalk - Dotnet
PPTX
UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 2
DOC
Final JAVA Practical of BCA SEM-5.
PDF
Java and j2ee_lab-manual
PPT
Java language fundamentals
DOCX
.net progrmming part1
PPTX
SPF Getting Started - Console Program
PPTX
Getting Started - Console Program and Problem Solving
PDF
CS Sample Paper 1
 
Dotnet 18
csharp dot net codes for practical examination
.net progrmming part3
C# Lab Programs.pdf
C# Lab Programs.pdf
Attributes & .NET components
C#.net
.net progrmming part2
delegates
TechTalk - Dotnet
UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 2
Final JAVA Practical of BCA SEM-5.
Java and j2ee_lab-manual
Java language fundamentals
.net progrmming part1
SPF Getting Started - Console Program
Getting Started - Console Program and Problem Solving
CS Sample Paper 1
 
Ad

More from Jannat Ruma (8)

PPTX
Windows Form - Lec12 (Workshop on C# Programming: Learn to Build)
PPTX
Class C# - Lec11 (Workshop on C# Programming: Learn to Build)
PPTX
String C# - Lec10 (Workshop on C# Programming: Learn to Build)
PPTX
Method C# - Lec8 (Workshop on C# Programming: Learn to Build)
PPTX
Loop C# - Lec7 (Workshop on C# Programming: Learn to Build)
PPTX
Decision Making C# - Lec6 (Workshop on C# Programming: Learn to Build)
PPTX
Variable C# - Lec5 (Workshop on C# Programming: Learn to Build)
PPTX
Operator C# - Lec3 (Workshop on C# Programming: Learn to Build)
Windows Form - Lec12 (Workshop on C# Programming: Learn to Build)
Class C# - Lec11 (Workshop on C# Programming: Learn to Build)
String C# - Lec10 (Workshop on C# Programming: Learn to Build)
Method C# - Lec8 (Workshop on C# Programming: Learn to Build)
Loop C# - Lec7 (Workshop on C# Programming: Learn to Build)
Decision Making C# - Lec6 (Workshop on C# Programming: Learn to Build)
Variable C# - Lec5 (Workshop on C# Programming: Learn to Build)
Operator C# - Lec3 (Workshop on C# Programming: Learn to Build)

Recently uploaded (20)

PPTX
master seminar digital applications in india
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PPTX
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
PPTX
Institutional Correction lecture only . . .
PPTX
Week 4 Term 3 Study Techniques revisited.pptx
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PPTX
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
PDF
01-Introduction-to-Information-Management.pdf
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
Classroom Observation Tools for Teachers
PDF
Pre independence Education in Inndia.pdf
PPTX
Cell Structure & Organelles in detailed.
PDF
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
Anesthesia in Laparoscopic Surgery in India
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
master seminar digital applications in india
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
Institutional Correction lecture only . . .
Week 4 Term 3 Study Techniques revisited.pptx
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
O7-L3 Supply Chain Operations - ICLT Program
102 student loan defaulters named and shamed – Is someone you know on the list?
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
01-Introduction-to-Information-Management.pdf
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
Classroom Observation Tools for Teachers
Pre independence Education in Inndia.pdf
Cell Structure & Organelles in detailed.
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
Microbial disease of the cardiovascular and lymphatic systems
FourierSeries-QuestionsWithAnswers(Part-A).pdf
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Anesthesia in Laparoscopic Surgery in India
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...

Type Casting C# - Lec4 (Workshop on C# Programming: Learn to Build)

  • 3. Type Casting using System; namespace dataType { class Program { static void Main(string[] args) { int a = 1; int b = 2; short result = (short) (a + b); Console.WriteLine(result); Console.Read(); } } }
  • 4. Type Casting using System; namespace dataType { class Program { static void Main(string[] args) { string String1 = "123"; int a = Int32.Parse(String1); Console.WriteLine(a); Console.Read(); } } }
  • 5. Type Casting using System; namespace dataType { class Program { static void Main(string[] args) { string String1 = "123"; string String2 = "321"; int c = Int32.Parse(String1) + Int32.Parse (String2); Console.WriteLine(c); Console.Read(); } } }
  • 6. Type Casting using System; namespace dataType { class Program { static void Main(string[] args) { string String2 = "321"; int b = Convert.ToInt32(String2); Console.WriteLine(b); Console.Read(); } } }
  • 7. Type Casting using System; namespace dataType { class Program { static void Main(string[] args) { string String1 = "123"; string String2 = "321"; int c = Convert.ToInt32 (String1) + Convert.ToInt32(String2); Console.WriteLine(c); Console.Read(); } } }
  • 8. Type Casting using System; namespace dataType { class Program { static void Main(string[] args) { string String1 = "123"; string String2 = "321"; int c = Int32.Parse.ToInt32 (String1) + Convert.ToInt32(String2); Console.WriteLine(c); Console.Read(); } } }
  • 9. Type Casting using System; namespace dataType { class Program { static void Main(string[] args) { double d = 123.998; int e = (int)d; Console.WriteLine(e); Console.Read(); } } }
  • 10. Type Casting using System; namespace dataType { class Program { static void Main(string[] args) { string String1 = "123"; int a = Int32.Parse(String1); object obj = a; int r = (int)obj; Console.WriteLine(r); Console.Read(); } } }
  • 11. This slide is provided as a course material in the workshop named “Workshop on C# Programming: Learn to Build”. Organized by- East West University Computer Programming Club (EWUCoPC) Prepared by- Jannat Binta Alam Campus Ambassador Young Engineers Society (YES) E-mail: jannat.cse.ewu@gmail.com