SlideShare a Scribd company logo
1 of 8
Lesson 5
Learn C#. Series of C# lessons
http://csharp.honcharuk.me/lesson-5
Agenda
• this
• Nested Types
• Structs
• Enums
• Guid
this
• The this keyword refers to the current instance of the class
class Coffe
{
private CoffeMachine _coffeMachine;
public Coffe(CoffeMachine
coffeMachine)
{
_coffeMachine = coffeMachine;
}
public bool Shugar { get; set; }
public bool Milk { get; set; }
public Coffe Cappuccino(bool sugar)
{
if (_coffeMachine.MilkAvailable)
{
Shugar = sugar;
Milk = true;
return this;
}
return null;
}
}
class CoffeMachine
{
public bool ShugarAvailable { get; set; }
public bool MilkAvailable { get; set; }
public Coffe GetCappuccino(bool sugar)
{
Coffe coffe = new Coffe(this);
return coffe.Cappuccino(ShugarAvailable);
}
}
CoffeMachine cm = new CoffeMachine();
cm.MilkAvailable = true;
Coffe coffe = cm.GetCappuccino(false);
Nested Types
Use a nested class when the class you are nesting is only useful to the
enclosing class.
class Settings
{
public class Screen
{
public int Brightness { get; set; }
public string Wallpaper { get; set; }
}
public class Sound
{
public int Volume { get; set; }
public bool Mute { get; set; }
}
public string UserName { get; set; }
public Screen ScreenConfig { get; set; }
public Sound SoundConfig { get; set; }
}
Settings settings = new Settings();
settings.ScreenConfig = new Settings.Screen();
settings.SoundConfig = new Settings.Sound();
Structs
• Structs may seem similar to classes, but there are important differences that you should be aware
of. First of all, classes are reference types and structs are value types. By using structs, you can
create objects that behave like the built-in types.
• Assignment to a variable of a struct type creates a copy of
the value being assigned
• A struct is not permitted to declare a parameterless
instance constructor
• A struct is not permitted to declare a destructor.
struct Point
{
public int X { get; set; }
public int Y { get; set; }
public Point(int x, int y)
{
X = x;
Y = y;
}
public void PrintCurrentPosition()
{
Console.WriteLine($"[{X}, {Y}]");
}
}
Enums
enum Gender
{
Male,
Female,
Undefined
}
enum Food
{
Vegetarian,
GlutenFree,
NutFree,
SoyFree,
DairyFree,
Organic,
Kosher,
FishFree
}
enum Alcohol
{
None = 0,
Light = 15,
Medium = 25,
Hot = 40
}
class Passenger
{
public Gender Gender { get; set; }
public Food Food { get; set; }
public Alcohol PrefferedAlcohol { get; set; }
}
Passenger applicant = new Passenger
{
Gender = Gender.Female,
Food = Food.Kosher,
PrefferedAlcohol = Alcohol.Hot
};
Guid
• GUID - a globally unique identifier
Guid g;
// Create and display the value of two GUIDs.
g = Guid.NewGuid();
Console.WriteLine(g);
Console.WriteLine(Guid.NewGuid());
Thank you!
Questions?

More Related Content

Similar to Lesson5

2. overview of c#
2. overview of c#2. overview of c#
2. overview of c#Rohit Rao
 
Kotlin for all the Things
Kotlin for all the ThingsKotlin for all the Things
Kotlin for all the ThingsEamonn Boyle
 
Testing the waters of iOS
Testing the waters of iOSTesting the waters of iOS
Testing the waters of iOSKremizas Kostas
 
Design patterns in the 21st Century
Design patterns in the 21st CenturyDesign patterns in the 21st Century
Design patterns in the 21st CenturySamir Talwar
 
Introduction to Kotlin for Android developers
Introduction to Kotlin for Android developersIntroduction to Kotlin for Android developers
Introduction to Kotlin for Android developersMohamed Wael
 
Oopsecondgrouppresentation 180726073512-converted (1)
Oopsecondgrouppresentation 180726073512-converted (1)Oopsecondgrouppresentation 180726073512-converted (1)
Oopsecondgrouppresentation 180726073512-converted (1)Hassan Hashmi
 
class as the basis.pptx
class as the basis.pptxclass as the basis.pptx
class as the basis.pptxEpsiba1
 
Polymorphism in C++
Polymorphism in C++Polymorphism in C++
Polymorphism in C++Rabin BK
 
Week9 Intro to classes and objects in Java
Week9 Intro to classes and objects in JavaWeek9 Intro to classes and objects in Java
Week9 Intro to classes and objects in Javakjkleindorfer
 
Design Patterns in the 21st Century - Samir Talwar
Design Patterns in the 21st Century - Samir TalwarDesign Patterns in the 21st Century - Samir Talwar
Design Patterns in the 21st Century - Samir TalwarJAXLondon2014
 
Effective Java and Kotlin
Effective Java and KotlinEffective Java and Kotlin
Effective Java and Kotlin경주 전
 
Build a Virtual Pet with JavaScript (May 2017, Santa Monica)
Build a Virtual Pet with JavaScript (May 2017, Santa Monica) Build a Virtual Pet with JavaScript (May 2017, Santa Monica)
Build a Virtual Pet with JavaScript (May 2017, Santa Monica) Thinkful
 
An Introduction to Property Based Testing
An Introduction to Property Based TestingAn Introduction to Property Based Testing
An Introduction to Property Based TestingC4Media
 
BangaloreJUG introduction to kotlin
BangaloreJUG   introduction to kotlinBangaloreJUG   introduction to kotlin
BangaloreJUG introduction to kotlinChandra Sekhar Nayak
 
Simpler Machine Learning with SKLL
Simpler Machine Learning with SKLLSimpler Machine Learning with SKLL
Simpler Machine Learning with SKLLDaniel Blanchard
 
2CPP07 - Inheritance
2CPP07 - Inheritance2CPP07 - Inheritance
2CPP07 - InheritanceMichael Heron
 
Bring the fun back to java
Bring the fun back to javaBring the fun back to java
Bring the fun back to javaciklum_ods
 

Similar to Lesson5 (20)

2. overview of c#
2. overview of c#2. overview of c#
2. overview of c#
 
Kotlin for all the Things
Kotlin for all the ThingsKotlin for all the Things
Kotlin for all the Things
 
Testing the waters of iOS
Testing the waters of iOSTesting the waters of iOS
Testing the waters of iOS
 
Design patterns in the 21st Century
Design patterns in the 21st CenturyDesign patterns in the 21st Century
Design patterns in the 21st Century
 
java tutorial 3
 java tutorial 3 java tutorial 3
java tutorial 3
 
Introduction to Kotlin for Android developers
Introduction to Kotlin for Android developersIntroduction to Kotlin for Android developers
Introduction to Kotlin for Android developers
 
Oopsecondgrouppresentation 180726073512-converted (1)
Oopsecondgrouppresentation 180726073512-converted (1)Oopsecondgrouppresentation 180726073512-converted (1)
Oopsecondgrouppresentation 180726073512-converted (1)
 
class as the basis.pptx
class as the basis.pptxclass as the basis.pptx
class as the basis.pptx
 
Polymorphism in C++
Polymorphism in C++Polymorphism in C++
Polymorphism in C++
 
Java session4
Java session4Java session4
Java session4
 
Kpi driven-java-development-fn conf
Kpi driven-java-development-fn confKpi driven-java-development-fn conf
Kpi driven-java-development-fn conf
 
Week9 Intro to classes and objects in Java
Week9 Intro to classes and objects in JavaWeek9 Intro to classes and objects in Java
Week9 Intro to classes and objects in Java
 
Design Patterns in the 21st Century - Samir Talwar
Design Patterns in the 21st Century - Samir TalwarDesign Patterns in the 21st Century - Samir Talwar
Design Patterns in the 21st Century - Samir Talwar
 
Effective Java and Kotlin
Effective Java and KotlinEffective Java and Kotlin
Effective Java and Kotlin
 
Build a Virtual Pet with JavaScript (May 2017, Santa Monica)
Build a Virtual Pet with JavaScript (May 2017, Santa Monica) Build a Virtual Pet with JavaScript (May 2017, Santa Monica)
Build a Virtual Pet with JavaScript (May 2017, Santa Monica)
 
An Introduction to Property Based Testing
An Introduction to Property Based TestingAn Introduction to Property Based Testing
An Introduction to Property Based Testing
 
BangaloreJUG introduction to kotlin
BangaloreJUG   introduction to kotlinBangaloreJUG   introduction to kotlin
BangaloreJUG introduction to kotlin
 
Simpler Machine Learning with SKLL
Simpler Machine Learning with SKLLSimpler Machine Learning with SKLL
Simpler Machine Learning with SKLL
 
2CPP07 - Inheritance
2CPP07 - Inheritance2CPP07 - Inheritance
2CPP07 - Inheritance
 
Bring the fun back to java
Bring the fun back to javaBring the fun back to java
Bring the fun back to java
 

More from Alex Honcharuk (7)

Lesson11
Lesson11Lesson11
Lesson11
 
Lesson9
Lesson9Lesson9
Lesson9
 
Lesson8
Lesson8Lesson8
Lesson8
 
Lesson6
Lesson6Lesson6
Lesson6
 
Lesson 4
Lesson 4Lesson 4
Lesson 4
 
Lesson2
Lesson2Lesson2
Lesson2
 
Lesson1
Lesson1Lesson1
Lesson1
 

Recently uploaded

HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
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
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
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
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)Suman Mia
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...RajaP95
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
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
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 

Recently uploaded (20)

HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
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, ...
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
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...
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
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
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
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
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 

Lesson5

  • 1. Lesson 5 Learn C#. Series of C# lessons http://csharp.honcharuk.me/lesson-5
  • 2. Agenda • this • Nested Types • Structs • Enums • Guid
  • 3. this • The this keyword refers to the current instance of the class class Coffe { private CoffeMachine _coffeMachine; public Coffe(CoffeMachine coffeMachine) { _coffeMachine = coffeMachine; } public bool Shugar { get; set; } public bool Milk { get; set; } public Coffe Cappuccino(bool sugar) { if (_coffeMachine.MilkAvailable) { Shugar = sugar; Milk = true; return this; } return null; } } class CoffeMachine { public bool ShugarAvailable { get; set; } public bool MilkAvailable { get; set; } public Coffe GetCappuccino(bool sugar) { Coffe coffe = new Coffe(this); return coffe.Cappuccino(ShugarAvailable); } } CoffeMachine cm = new CoffeMachine(); cm.MilkAvailable = true; Coffe coffe = cm.GetCappuccino(false);
  • 4. Nested Types Use a nested class when the class you are nesting is only useful to the enclosing class. class Settings { public class Screen { public int Brightness { get; set; } public string Wallpaper { get; set; } } public class Sound { public int Volume { get; set; } public bool Mute { get; set; } } public string UserName { get; set; } public Screen ScreenConfig { get; set; } public Sound SoundConfig { get; set; } } Settings settings = new Settings(); settings.ScreenConfig = new Settings.Screen(); settings.SoundConfig = new Settings.Sound();
  • 5. Structs • Structs may seem similar to classes, but there are important differences that you should be aware of. First of all, classes are reference types and structs are value types. By using structs, you can create objects that behave like the built-in types. • Assignment to a variable of a struct type creates a copy of the value being assigned • A struct is not permitted to declare a parameterless instance constructor • A struct is not permitted to declare a destructor. struct Point { public int X { get; set; } public int Y { get; set; } public Point(int x, int y) { X = x; Y = y; } public void PrintCurrentPosition() { Console.WriteLine($"[{X}, {Y}]"); } }
  • 6. Enums enum Gender { Male, Female, Undefined } enum Food { Vegetarian, GlutenFree, NutFree, SoyFree, DairyFree, Organic, Kosher, FishFree } enum Alcohol { None = 0, Light = 15, Medium = 25, Hot = 40 } class Passenger { public Gender Gender { get; set; } public Food Food { get; set; } public Alcohol PrefferedAlcohol { get; set; } } Passenger applicant = new Passenger { Gender = Gender.Female, Food = Food.Kosher, PrefferedAlcohol = Alcohol.Hot };
  • 7. Guid • GUID - a globally unique identifier Guid g; // Create and display the value of two GUIDs. g = Guid.NewGuid(); Console.WriteLine(g); Console.WriteLine(Guid.NewGuid());

Editor's Notes

  1. https://msdn.microsoft.com/en-us/library/dk1507sz.aspx
  2. https://msdn.microsoft.com/en-us/library/ms173120.aspx
  3. https://msdn.microsoft.com/uk-ua/library/aa288471(v=vs.71).aspx
  4. https://msdn.microsoft.com/en-us/library/sbbt4032.aspx
  5. https://msdn.microsoft.com/en-us/library/system.guid.newguid(v=vs.110).aspx