SlideShare ist ein Scribd-Unternehmen logo
1 von 13
Lesson 1
Learn C#. Series of C# lessons
http://csharp.honcharuk.me/lesson-1
Agenda
• OOP theory
• Development Environment
• C# types
• A First C# Program
Development Environment
• Visual Studio 2015
• ReSharper (https://www.jetbrains.com/resharper)
Object-oriented programming
• OOP is a way of organizing the code in a program by grouping it
into objects
• Object is an individual element that includes information (data
values) and functionality
Body
Head
Eye
Nose
Mouth
Ear
Hand
Finger
Leg
Finger
Class
• classes describe the type of objects
• objects are usable instances of classes
• the act of creating an object is called instantiation
class Eye
{
public string Color { get; set; }
}
class Ear
{
public void Listen()
{
Console.WriteLine("Listening...");
}
}
class Finger
{
public string NailColor { get; set; }
}
class Hand
{
public Finger[] Fingers { get; set; } = new Finger[5];
}
class Leg
{
public Finger[] Fingers { get; set; } = new Finger[5];
}
class Mouth
{
public bool IsMouthOpened { get; set; }
public void Open()
{
Console.WriteLine("Mouth is opened.");
}
public void Close()
{
Console.WriteLine("Mouth is closed.");
}
}
class Nose
{
public void ToSniff()
{
Console.WriteLine("Sniffing...");
}
public void ToSneeze()
{
Console.WriteLine("Sneeze...");
}
}
class Head
{
public Eye LeftEye { get; set; }
public Eye RightEye { get; set; }
public Mouth Mouth { get; set; }
public Ear LeftEar { get; set; }
public Ear RightEar { get; set; }
public Nose Nose { get; set; }
}
class Body
{
public string Name { get; set; }
public int Weight { get; set; }
public int High { get; set; }
public Head Head { get; set; }
public Hand[] Hands { get; set; } = new Hand[2];
public Leg[] Legs { get; set; } = new Leg[2];
}
Classes demo:
Value Types
Type Represents Range Default Value
bool Boolean value True or False False
byte 8-bit unsigned integer 0 to 255 0
char 16-bit Unicode character U +0000 to U +ffff '0'
decimal 128-bit precise decimal values
with 28-29 significant digits
(-7.9 x 10
28
to 7.9 x 10
28
) / 10
0 to 28
0.0M
double 64-bit double-precision
floating point type
(+/-)5.0 x 10
-324
to (+/-)1.7 x 10
308
0.0D
float 32-bit single-precision floating
point type
-3.4 x 10
38
to + 3.4 x 10
38
0.0F
int 32-bit signed integer type -2,147,483,648 to 2,147,483,647 0
long 64-bit signed integer type -9,223,372,036,854,775,808 to
9,223,372,036,854,775,807
0L
sbyte 8-bit signed integer type -128 to 127 0
short 16-bit signed integer type -32,768 to 32,767 0
uint 32-bit unsigned integer type 0 to 4,294,967,295 0
ulong 64-bit unsigned integer type 0 to 18,446,744,073,709,551,615 0
ushort 16-bit unsigned integer type 0 to 65,535 0
Reference types
• class
• interface
• delegate
Stack and Heap (Demo)
• Value Type - stores its contents in memory allocated on the stack. When you created a Value Type, a single
space in memory is allocated to store the value and that variable directly holds a value.
• Reference Types - are used by a reference which holds a reference (address) to the object but not the object
itself. Because reference types represent the address of the variable rather than the data itself, assigning a
reference variable to another doesn't copy the data. Instead it creates a second copy of the reference, which
refers to the same location of the heap as the original value.
Stack Heap
Value types
Pointers to the reference types
Reference types
Boxing and unboxing
System.Object is a parent type for all other types
Boxing is the process of converting a value type to the type object.
The reverse process called unboxing.
int i = 123;
// The following line boxes i.
object o = i;
o = 123;
i = (int)o; // unboxing
Mutable and Immutable types
• Mutable type – multiple values can be assigned to mutable object
many times and its state can be altered
• Immutable type – immutable classes are read-only. Once declared
their value cannot be changed
Nullable type
int? value = null;
Console.WriteLine(value.HasValue);
//
// Assign the nullable integer to a constant integer.
// ... The HasValue property is now true.
// ... You can access the Value property as well.
//
value = 1;
Console.WriteLine(value.HasValue);
Console.WriteLine(value.Value);
Console.WriteLine(value);
Thank you!
Questions?

Weitere ähnliche Inhalte

Was ist angesagt?

Variables in C++, data types in c++
Variables in C++, data types in c++Variables in C++, data types in c++
Variables in C++, data types in c++Neeru Mittal
 
Data types in java | What is Datatypes in Java | Learning with RD | Created b...
Data types in java | What is Datatypes in Java | Learning with RD | Created b...Data types in java | What is Datatypes in Java | Learning with RD | Created b...
Data types in java | What is Datatypes in Java | Learning with RD | Created b...rahuldaredia21
 
C# Summer course - Lecture 2
C# Summer course - Lecture 2C# Summer course - Lecture 2
C# Summer course - Lecture 2mohamedsamyali
 
Basic Data Types in C++
Basic Data Types in C++ Basic Data Types in C++
Basic Data Types in C++ Hridoy Bepari
 
Visula C# Programming Lecture 6
Visula C# Programming Lecture 6Visula C# Programming Lecture 6
Visula C# Programming Lecture 6Abou Bakr Ashraf
 
Object Oriented Programming with C#
Object Oriented Programming with C#Object Oriented Programming with C#
Object Oriented Programming with C#foreverredpb
 
ITFT-Constants, variables and data types in java
ITFT-Constants, variables and data types in javaITFT-Constants, variables and data types in java
ITFT-Constants, variables and data types in javaAtul Sehdev
 
Java data types, variables and jvm
Java data types, variables and jvm Java data types, variables and jvm
Java data types, variables and jvm Madishetty Prathibha
 
Compiler Construction | Lecture 7 | Type Checking
Compiler Construction | Lecture 7 | Type CheckingCompiler Construction | Lecture 7 | Type Checking
Compiler Construction | Lecture 7 | Type CheckingEelco Visser
 
Data types and Operators
Data types and OperatorsData types and Operators
Data types and Operatorsraksharao
 
Introduction to c++
Introduction to c++Introduction to c++
Introduction to c++NIDA HUSSAIN
 
2 programming with c# i
2 programming with c# i2 programming with c# i
2 programming with c# isiragezeynu
 
Visula C# Programming Lecture 8
Visula C# Programming Lecture 8Visula C# Programming Lecture 8
Visula C# Programming Lecture 8Abou Bakr Ashraf
 
Primitive data types in java
Primitive data types in javaPrimitive data types in java
Primitive data types in javaUmamaheshwariv1
 

Was ist angesagt? (20)

Variables in C++, data types in c++
Variables in C++, data types in c++Variables in C++, data types in c++
Variables in C++, data types in c++
 
Data types in java | What is Datatypes in Java | Learning with RD | Created b...
Data types in java | What is Datatypes in Java | Learning with RD | Created b...Data types in java | What is Datatypes in Java | Learning with RD | Created b...
Data types in java | What is Datatypes in Java | Learning with RD | Created b...
 
C# Summer course - Lecture 2
C# Summer course - Lecture 2C# Summer course - Lecture 2
C# Summer course - Lecture 2
 
Lect 9(pointers) Zaheer Abbas
Lect 9(pointers) Zaheer AbbasLect 9(pointers) Zaheer Abbas
Lect 9(pointers) Zaheer Abbas
 
Basic Data Types in C++
Basic Data Types in C++ Basic Data Types in C++
Basic Data Types in C++
 
Visula C# Programming Lecture 6
Visula C# Programming Lecture 6Visula C# Programming Lecture 6
Visula C# Programming Lecture 6
 
Object Oriented Programming with C#
Object Oriented Programming with C#Object Oriented Programming with C#
Object Oriented Programming with C#
 
Basic c#
Basic c#Basic c#
Basic c#
 
Lecture 4
Lecture 4Lecture 4
Lecture 4
 
ITFT-Constants, variables and data types in java
ITFT-Constants, variables and data types in javaITFT-Constants, variables and data types in java
ITFT-Constants, variables and data types in java
 
Java data types, variables and jvm
Java data types, variables and jvm Java data types, variables and jvm
Java data types, variables and jvm
 
C++ data types
C++ data typesC++ data types
C++ data types
 
Compiler Construction | Lecture 7 | Type Checking
Compiler Construction | Lecture 7 | Type CheckingCompiler Construction | Lecture 7 | Type Checking
Compiler Construction | Lecture 7 | Type Checking
 
Data types
Data typesData types
Data types
 
Data types and Operators
Data types and OperatorsData types and Operators
Data types and Operators
 
Introduction to c++
Introduction to c++Introduction to c++
Introduction to c++
 
Data Handling
Data HandlingData Handling
Data Handling
 
2 programming with c# i
2 programming with c# i2 programming with c# i
2 programming with c# i
 
Visula C# Programming Lecture 8
Visula C# Programming Lecture 8Visula C# Programming Lecture 8
Visula C# Programming Lecture 8
 
Primitive data types in java
Primitive data types in javaPrimitive data types in java
Primitive data types in java
 

Andere mochten auch

Απάντηση Ν. Τόσκα σε αναφορά Ν. Μηταράκη για την προστασία των οικογενειών θα...
Απάντηση Ν. Τόσκα σε αναφορά Ν. Μηταράκη για την προστασία των οικογενειών θα...Απάντηση Ν. Τόσκα σε αναφορά Ν. Μηταράκη για την προστασία των οικογενειών θα...
Απάντηση Ν. Τόσκα σε αναφορά Ν. Μηταράκη για την προστασία των οικογενειών θα...Notis Mitarachi
 
Assignment 3 EDRD*6000 - asima naeem
Assignment 3 EDRD*6000 - asima naeemAssignment 3 EDRD*6000 - asima naeem
Assignment 3 EDRD*6000 - asima naeemAsima Naeem
 
In Pursuit of Perfection
In Pursuit of PerfectionIn Pursuit of Perfection
In Pursuit of PerfectionNaren Israney
 
Ragnhild Fresvik
Ragnhild FresvikRagnhild Fresvik
Ragnhild FresvikStormkast
 
Periódico institucional segundo trimestre 2015
Periódico institucional segundo trimestre 2015Periódico institucional segundo trimestre 2015
Periódico institucional segundo trimestre 2015asociacioncivilperija
 
Conexiones de acero: aplicaciones, ventajas y beneficios
Conexiones de acero: aplicaciones, ventajas y beneficiosConexiones de acero: aplicaciones, ventajas y beneficios
Conexiones de acero: aplicaciones, ventajas y beneficiosDincorsa
 

Andere mochten auch (9)

Απάντηση Ν. Τόσκα σε αναφορά Ν. Μηταράκη για την προστασία των οικογενειών θα...
Απάντηση Ν. Τόσκα σε αναφορά Ν. Μηταράκη για την προστασία των οικογενειών θα...Απάντηση Ν. Τόσκα σε αναφορά Ν. Μηταράκη για την προστασία των οικογενειών θα...
Απάντηση Ν. Τόσκα σε αναφορά Ν. Μηταράκη για την προστασία των οικογενειών θα...
 
Merged document 161
Merged document 161Merged document 161
Merged document 161
 
Assignment 3 EDRD*6000 - asima naeem
Assignment 3 EDRD*6000 - asima naeemAssignment 3 EDRD*6000 - asima naeem
Assignment 3 EDRD*6000 - asima naeem
 
Inovaccion
InovaccionInovaccion
Inovaccion
 
Book
BookBook
Book
 
In Pursuit of Perfection
In Pursuit of PerfectionIn Pursuit of Perfection
In Pursuit of Perfection
 
Ragnhild Fresvik
Ragnhild FresvikRagnhild Fresvik
Ragnhild Fresvik
 
Periódico institucional segundo trimestre 2015
Periódico institucional segundo trimestre 2015Periódico institucional segundo trimestre 2015
Periódico institucional segundo trimestre 2015
 
Conexiones de acero: aplicaciones, ventajas y beneficios
Conexiones de acero: aplicaciones, ventajas y beneficiosConexiones de acero: aplicaciones, ventajas y beneficios
Conexiones de acero: aplicaciones, ventajas y beneficios
 

Ähnlich wie Lesson1

Ähnlich wie Lesson1 (20)

Structured Languages
Structured LanguagesStructured Languages
Structured Languages
 
P1
P1P1
P1
 
Introduction To C#
Introduction To C#Introduction To C#
Introduction To C#
 
IntroductionToCSharp.ppt
IntroductionToCSharp.pptIntroductionToCSharp.ppt
IntroductionToCSharp.ppt
 
Introduction toc sharp
Introduction toc sharpIntroduction toc sharp
Introduction toc sharp
 
IntroductionToCSharp.ppt
IntroductionToCSharp.pptIntroductionToCSharp.ppt
IntroductionToCSharp.ppt
 
IntroductionToCSharp.ppt
IntroductionToCSharp.pptIntroductionToCSharp.ppt
IntroductionToCSharp.ppt
 
5variables in c#
5variables in c#5variables in c#
5variables in c#
 
02 Primitive data types and variables
02 Primitive data types and variables02 Primitive data types and variables
02 Primitive data types and variables
 
2.Getting Started with C#.Net-(C#)
2.Getting Started with C#.Net-(C#)2.Getting Started with C#.Net-(C#)
2.Getting Started with C#.Net-(C#)
 
C#
C#C#
C#
 
Data types
Data typesData types
Data types
 
Java Programming For Android
Java Programming For AndroidJava Programming For Android
Java Programming For Android
 
02. Primitive Data Types and Variables
02. Primitive Data Types and Variables02. Primitive Data Types and Variables
02. Primitive Data Types and Variables
 
unit 1 (1).pptx
unit 1 (1).pptxunit 1 (1).pptx
unit 1 (1).pptx
 
Chapter 2 c#
Chapter 2 c#Chapter 2 c#
Chapter 2 c#
 
Notes(1).pptx
Notes(1).pptxNotes(1).pptx
Notes(1).pptx
 
Presentation 2nd
Presentation 2ndPresentation 2nd
Presentation 2nd
 
Data Types, Variables, and Constants in C# Programming
Data Types, Variables, and Constants in C# ProgrammingData Types, Variables, and Constants in C# Programming
Data Types, Variables, and Constants in C# Programming
 
About Python
About PythonAbout Python
About Python
 

Mehr von Alex Honcharuk (8)

Lesson11
Lesson11Lesson11
Lesson11
 
Lesson 10
Lesson 10Lesson 10
Lesson 10
 
Lesson9
Lesson9Lesson9
Lesson9
 
Lesson8
Lesson8Lesson8
Lesson8
 
Lesson6
Lesson6Lesson6
Lesson6
 
Lesson5
Lesson5Lesson5
Lesson5
 
Lesson 4
Lesson 4Lesson 4
Lesson 4
 
Lesson2
Lesson2Lesson2
Lesson2
 

Kürzlich hochgeladen

Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringmulugeta48
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...SUHANI PANDEY
 
Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Christo Ananth
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTbhaskargani46
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Christo Ananth
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXssuser89054b
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueBhangaleSonal
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdfKamal Acharya
 

Kürzlich hochgeladen (20)

Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineering
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
 
Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...
 
NFPA 5000 2024 standard .
NFPA 5000 2024 standard                                  .NFPA 5000 2024 standard                                  .
NFPA 5000 2024 standard .
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
 
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 

Lesson1

  • 1. Lesson 1 Learn C#. Series of C# lessons http://csharp.honcharuk.me/lesson-1
  • 2. Agenda • OOP theory • Development Environment • C# types • A First C# Program
  • 3. Development Environment • Visual Studio 2015 • ReSharper (https://www.jetbrains.com/resharper)
  • 4. Object-oriented programming • OOP is a way of organizing the code in a program by grouping it into objects • Object is an individual element that includes information (data values) and functionality Body Head Eye Nose Mouth Ear Hand Finger Leg Finger
  • 5. Class • classes describe the type of objects • objects are usable instances of classes • the act of creating an object is called instantiation
  • 6. class Eye { public string Color { get; set; } } class Ear { public void Listen() { Console.WriteLine("Listening..."); } } class Finger { public string NailColor { get; set; } } class Hand { public Finger[] Fingers { get; set; } = new Finger[5]; } class Leg { public Finger[] Fingers { get; set; } = new Finger[5]; } class Mouth { public bool IsMouthOpened { get; set; } public void Open() { Console.WriteLine("Mouth is opened."); } public void Close() { Console.WriteLine("Mouth is closed."); } } class Nose { public void ToSniff() { Console.WriteLine("Sniffing..."); } public void ToSneeze() { Console.WriteLine("Sneeze..."); } } class Head { public Eye LeftEye { get; set; } public Eye RightEye { get; set; } public Mouth Mouth { get; set; } public Ear LeftEar { get; set; } public Ear RightEar { get; set; } public Nose Nose { get; set; } } class Body { public string Name { get; set; } public int Weight { get; set; } public int High { get; set; } public Head Head { get; set; } public Hand[] Hands { get; set; } = new Hand[2]; public Leg[] Legs { get; set; } = new Leg[2]; } Classes demo:
  • 7. Value Types Type Represents Range Default Value bool Boolean value True or False False byte 8-bit unsigned integer 0 to 255 0 char 16-bit Unicode character U +0000 to U +ffff '0' decimal 128-bit precise decimal values with 28-29 significant digits (-7.9 x 10 28 to 7.9 x 10 28 ) / 10 0 to 28 0.0M double 64-bit double-precision floating point type (+/-)5.0 x 10 -324 to (+/-)1.7 x 10 308 0.0D float 32-bit single-precision floating point type -3.4 x 10 38 to + 3.4 x 10 38 0.0F int 32-bit signed integer type -2,147,483,648 to 2,147,483,647 0 long 64-bit signed integer type -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 0L sbyte 8-bit signed integer type -128 to 127 0 short 16-bit signed integer type -32,768 to 32,767 0 uint 32-bit unsigned integer type 0 to 4,294,967,295 0 ulong 64-bit unsigned integer type 0 to 18,446,744,073,709,551,615 0 ushort 16-bit unsigned integer type 0 to 65,535 0
  • 8. Reference types • class • interface • delegate
  • 9. Stack and Heap (Demo) • Value Type - stores its contents in memory allocated on the stack. When you created a Value Type, a single space in memory is allocated to store the value and that variable directly holds a value. • Reference Types - are used by a reference which holds a reference (address) to the object but not the object itself. Because reference types represent the address of the variable rather than the data itself, assigning a reference variable to another doesn't copy the data. Instead it creates a second copy of the reference, which refers to the same location of the heap as the original value. Stack Heap Value types Pointers to the reference types Reference types
  • 10. Boxing and unboxing System.Object is a parent type for all other types Boxing is the process of converting a value type to the type object. The reverse process called unboxing. int i = 123; // The following line boxes i. object o = i; o = 123; i = (int)o; // unboxing
  • 11. Mutable and Immutable types • Mutable type – multiple values can be assigned to mutable object many times and its state can be altered • Immutable type – immutable classes are read-only. Once declared their value cannot be changed
  • 12. Nullable type int? value = null; Console.WriteLine(value.HasValue); // // Assign the nullable integer to a constant integer. // ... The HasValue property is now true. // ... You can access the Value property as well. // value = 1; Console.WriteLine(value.HasValue); Console.WriteLine(value.Value); Console.WriteLine(value);

Hinweis der Redaktion

  1. http://www.tutorialspoint.com/csharp/csharp_data_types.htm
  2. https://msdn.microsoft.com/en-us/library/490f96s2.aspx
  3. https://msdn.microsoft.com/en-us/library/yz2be5wk.aspx