O slideshow foi denunciado.
Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.

Lesson5

230 visualizações

Publicada em

Learn C#

Publicada em: Engenharia
  • DOWNLOAD FULL. BOOKS INTO AVAILABLE FORMAT, ......................................................................................................................... ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Responder 
    Tem certeza que deseja  Sim  Não
    Insira sua mensagem aqui
  • DOWNLOAD FULL. BOOKS INTO AVAILABLE FORMAT ......................................................................................................................... ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Responder 
    Tem certeza que deseja  Sim  Não
    Insira sua mensagem aqui
  • DOWNLOAD FULL. BOOKS INTO AVAILABLE FORMAT ......................................................................................................................... ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Responder 
    Tem certeza que deseja  Sim  Não
    Insira sua mensagem aqui
  • Seja a primeira pessoa a gostar disto

Lesson5

  1. 1. Lesson 5 Learn C#. Series of C# lessons http://csharp.honcharuk.me/lesson-5
  2. 2. Agenda • this • Nested Types • Structs • Enums • Guid
  3. 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. 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. 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. 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. 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());
  8. 8. Thank you! Questions?

×