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)

PPTX
19csharp
PPTX
PPT
Introduction to C#
PPT
Introduction of C# BY Adarsh Singh
PPTX
Getting Started - Console Program and Problem Solving
PPTX
SPF Getting Started - Console Program
PPT
Presentatiooooooooooon00000000000001.ppt
PPTX
Chapter 2 c#
PPTX
data types in C-Sharp (C#)
PPTX
04. Console Input Output
PPTX
2 programming with c# i
PDF
C# Data Types and Comments_Lecture2_C#.pdf
PPTX
Core C# Programming Constructs, Part 1
PPTX
5variables in c#
PPTX
Getting started with C# Programming
PPTX
CSharp Language Overview Part 1
PDF
434090527-C-Cheat-Sheet. pdf C# program
PPT
Synapseindia dot net development
PPT
Introduction To C#
PPT
C Language fundamentals hhhhhhhhhhhh.ppt
19csharp
Introduction to C#
Introduction of C# BY Adarsh Singh
Getting Started - Console Program and Problem Solving
SPF Getting Started - Console Program
Presentatiooooooooooon00000000000001.ppt
Chapter 2 c#
data types in C-Sharp (C#)
04. Console Input Output
2 programming with c# i
C# Data Types and Comments_Lecture2_C#.pdf
Core C# Programming Constructs, Part 1
5variables in c#
Getting started with C# Programming
CSharp Language Overview Part 1
434090527-C-Cheat-Sheet. pdf C# program
Synapseindia dot net development
Introduction To C#
C Language fundamentals hhhhhhhhhhhh.ppt
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)

PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
Insiders guide to clinical Medicine.pdf
PDF
The Final Stretch: How to Release a Game and Not Die in the Process.
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
Piense y hagase Rico - Napoleon Hill Ccesa007.pdf
PPTX
Week 4 Term 3 Study Techniques revisited.pptx
PDF
Mga Unang Hakbang Tungo Sa Tao by Joe Vibar Nero.pdf
PDF
Business Ethics Teaching Materials for college
PPTX
NOI Hackathon - Summer Edition - GreenThumber.pptx
PDF
Anesthesia in Laparoscopic Surgery in India
PPTX
How to Manage Starshipit in Odoo 18 - Odoo Slides
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
Module 3: Health Systems Tutorial Slides S2 2025
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
Pre independence Education in Inndia.pdf
O7-L3 Supply Chain Operations - ICLT Program
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
STATICS OF THE RIGID BODIES Hibbelers.pdf
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Insiders guide to clinical Medicine.pdf
The Final Stretch: How to Release a Game and Not Die in the Process.
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
Piense y hagase Rico - Napoleon Hill Ccesa007.pdf
Week 4 Term 3 Study Techniques revisited.pptx
Mga Unang Hakbang Tungo Sa Tao by Joe Vibar Nero.pdf
Business Ethics Teaching Materials for college
NOI Hackathon - Summer Edition - GreenThumber.pptx
Anesthesia in Laparoscopic Surgery in India
How to Manage Starshipit in Odoo 18 - Odoo Slides
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Module 3: Health Systems Tutorial Slides S2 2025
O5-L3 Freight Transport Ops (International) V1.pdf
Pre independence Education in Inndia.pdf

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: [email protected]