This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Movie | |
{ | |
public string Title { get; private set; } | |
public List<string> Genres { get; private set; } | |
public Movie() | |
{ | |
Title = "The Big Lebowski"; | |
Genres = new List<string> { "Comedy", "Crime" }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Movie | |
{ | |
public string Title { get; } = "The Big Lebowski"; | |
public List<string> Genres { get; } = new List<string> { "Comedy", "Crime" }; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Movie | |
{ | |
private readonly string <Title>k__BackingField | |
private readonly List<string> <Genres>k__BackingField; | |
public string Title | |
{ | |
get { return this.<Title>k__BackingField; } | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Movie | |
{ | |
public string Title { get; private set; } | |
public List<string> Genres { get; private set; } | |
public Movie(string title, List<string> genres) | |
{ | |
Title = title; | |
Genres = genres; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Movie(string title, List<string> genres) | |
{ | |
public string Title { get; } = title; | |
public List<string> Genres { get; } = genres; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Movie | |
{ | |
private readonly string <Title>k__BackingField | |
private readonly List<string> <Genres>k__BackingField; | |
public string Title | |
{ | |
get { return this.<Title>k__BackingField; } | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Movie(string title, List<string> genres) | |
{ | |
public string Title { get; } = title; | |
public List<string> Genres { get; } = genres; | |
public int Runtime { get; private set; } | |
public Movie(string title, List<string> genres, int runtime) : this(title, genres) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Movie | |
{ | |
private readonly string <Title>k__BackingField | |
private readonly List<string> <Genres>k__BackingField; | |
private readonly int <Runtime>k__BackingField | |
public string Title | |
{ | |
get { return this.<Title>k__BackingField; } | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bool result; | |
if (bool.TryParse("true", out result)) | |
{ | |
Console.WriteLine("This is a bool with value. " + result); | |
} | |
else | |
{ | |
Console.WriteLine("Not a bool, yo! " + result); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (bool.TryParse("true", out var result)) | |
{ | |
Console.WriteLine("This is a bool with value. " + result); | |
} | |
else | |
{ | |
Console.WriteLine("Not a bool, yo! " + result); | |
} |