this.id = id; Name = name; } int id; public int Id { get { return id; } } string name; public string Name { get { return name; } set { name = value; } } } public class MonkeyUtils { public static ArrayList GetMonkeys() { ArrayList monkeys = new ArrayList(); monkeys.Add(new Monkey(1, "Sebastian")); monkeys.Add(new Monkey(2, "Sofia")); monkeys.Add(new Monkey(3, "Sofia")); Monkey monkey = (Monkey)monkeys[2]; monkey.Name = "Henry"; return monkeys; } }
= id } public Monkey(int? id, string name) { Id = id; Name = name; } public int? Id { get; private set; } public string Name { get; set; } } public static class MonkeyUtils30 { public static List<Monkey> GetMonkeys() { var monkeys = new List<Monkey> { new Monkey(1) { Name = "Sebastian” }, new Monkey(2) { Name = "Sofia” }, new Monkey(3) { Name = "Sofia” }, }; var monkey = monkeys.First(m => m.Id == 3); monkey.Name = "Henry"; monkeys = monkeys.OrderBy(m => m.Name); return monkeys; } }
string name = string.Empty) { Id = id; Name = name; } public int? Id { get; private set; } public string Name { get; set; } } public static class MonkeyUtils { public static List<Monkey> GetMonkeys(bool sort = false) { var monkeys = new List<Monkey> { new Monkey(1) { Name = "Sebastian” }, new Monkey(2) { Name = "Sofia” }, new Monkey(3) { Name = "Sofia” }, }; monkeys.Add(new Monkey(name: "George”)); var monkey = monkeys.First(m => m.Id == 3); monkey.Name = "Henry"; if(sort) monkeys = monkeys.OrderBy(m => m.Name); return monkeys; } public static void Test() { var monkeys1 = GetMonkeys(); var monkeys2 = GetMonkeys(false);//same as above var monkeys3 = GetMonkeys(sort: true); }
id, string name, string location) { Id = id; Name = name; Location = location; } public int Id { get; private set; } public string Name { get; set; } public string Location { get; set; } public DayOfWeek MostActiveDay { get { return Id == 0 ? DayOfWeek.Friday : DayOfWeek.Monday; } } public void Print() { Console.WriteLine("We printed some stuff"); } public string DisplayName { get { return string.Format("Monkey {0} lives in {1} with Id of {2}", Name, Location, Id); }
id, string name, string location) { Id = id; Name = name; Location = location; } public int Id { get; private set; } public string Name { get; set; } public string Location { get; set; } public DayOfWeek MostActiveDay { get { return Id == 0 ? DayOfWeek.Friday : DayOfWeek.Monday; } } public void Print() { Console.WriteLine("We printed some stuff"); } public string DisplayName { get { return string.Format("Monkey {0} lives in {1} with Id of {2}", Name, Location, Id); }
id, string name, string location) { Id = id; Name = name; Location = location; } public int Id { get; } public string Name { get; } public string Location { get; set; } public DayOfWeek MostActiveDay { get { return Id == 0 ? DayOfWeek.Friday : DayOfWeek.Monday; } } public void Print() { Console.WriteLine("We printed some stuff"); } public string DisplayName { get { return string.Format("Monkey {0} lives in {1} with Id of {2}", Name, Location, Id); }
id, string name, string location) { Id = id; Name = name; Location = location; } public int Id { get; } = 0; public string Name { get; } = "Sofia"; public string Location { get; set; } = "South America"; public DayOfWeek MostActiveDay { get { return Id == 0 ? DayOfWeek.Friday : DayOfWeek.Monday; } } public void Print() { Console.WriteLine("We printed some stuff"); } public string DisplayName { get { return string.Format("Monkey {0} lives in {1} with Id of {2}", Name, Location, Id); }
id, string name, string location) { Id = id; Name = name; Location = location; } public int Id { get; } = 0; public string Name { get; } = "Sofia"; public string Location { get; set; } = "South America"; public DayOfWeek MostActiveDay { get { return Id == 0 ? DayOfWeek.Friday : DayOfWeek.Monday; } } public void Print() { Console.WriteLine("We printed some stuff"); } public string DisplayName { get { return string.Format("Monkey {0} lives in {1} with Id of {2}",
public Monkey() { } public Monkey(int id, string name, string location) { Id = id; Name = name; Location = location; } public int Id { get; } = 0; public string Name { get; } = "Sofia"; public string Location { get; set; } = "South America"; public DayOfWeek MostActiveDay { get { return Id == 0 ? Friday : Monday; } } public void Print() { WriteLine("We printed some stuff"); } public string DisplayName { get { return string.Format("Monkey {0} lives in {1} with Id of {2}",
public Monkey() { } public Monkey(int id, string name, string location) { Id = id; Name = name; Location = location; } public int Id { get; } = 0; public string Name { get; } = "Sofia"; public string Location { get; set; } = "South America"; public DayOfWeek MostActiveDay { get { return Id == 0 ? Friday : Monday; } } public void Print() { WriteLine("We printed some stuff"); } public string DisplayName { get { return string.Format("Monkey {0} lives in {1} with Id of {2}",
public Monkey() { } public Monkey(int id, string name, string location) { Id = id; Name = name; Location = location; } public int Id { get; } = 0; public string Name { get; } = "Sofia"; public string Location { get; set; } = "South America"; public DayOfWeek MostActiveDay => Id == 0 ? Friday : Monday; public void Print() { WriteLine("We printed some stuff"); } public string DisplayName { get { return string.Format("Monkey {0} lives in {1} with Id of {2}", Name, Location, Id); }
public Monkey() { } public Monkey(int id, string name, string location) { Id = id; Name = name; Location = location; } public int Id { get; } = 0; public string Name { get; } = "Sofia"; public string Location { get; set; } = "South America"; public DayOfWeek MostActiveDay => Id == 0 ? Friday : Monday; public void Print() { WriteLine("We printed some stuff"); } public string DisplayName { get { return string.Format("Monkey {0} lives in {1} with Id of {2}", Name, Location, Id); }
public Monkey() { } public Monkey(int id, string name, string location) { Id = id; Name = name; Location = location; } public int Id { get; } = 0; public string Name { get; } = "Sofia"; public string Location { get; set; } = "South America"; public DayOfWeek MostActiveDay => Id == 0 ? Friday : Monday; public void Print() => WriteLine("We printed some stuff"); public string DisplayName { get { return string.Format("Monkey {0} lives in {1} with Id of {2}", Name, Location, Id); } } }
public Monkey() { } public Monkey(int id, string name, string location) { Id = id; Name = name; Location = location; } public int Id { get; } = 0; public string Name { get; } = "Sofia"; public string Location { get; set; } = "South America"; public DayOfWeek MostActiveDay => Id == 0 ? Friday : Monday; public void Print() => WriteLine("We printed some stuff"); public string DisplayName { get { return string.Format("Monkey {0} lives in {1} with Id of {2}", Name, Location, Id); } } }
public Monkey() { } public Monkey(int id, string name, string location) { Id = id; Name = name; Location = location; } public int Id { get; } = 0; public string Name { get; } = "Sofia"; public string Location { get; set; } = "South America"; public DayOfWeek MostActiveDay => Id == 0 ? Friday : Monday; public void Print() => WriteLine("We printed some stuff"); public string DisplayName { get { return $"Monkey {Name} lives in {Location} with Id of {Id}"; } } }
public Monkey() { } public Monkey(int id, string name, string location) { Id = id; Name = name; Location = location; } public int Id { get; } = 0; public string Name { get; } = "Sofia"; public string Location { get; set; } = "South America"; public DayOfWeek MostActiveDay => return Id == 0 ? Friday : Monday; public void Print() => WriteLine("We printed some stuff"); public string DisplayName { get { return $"Monkey {Name} lives in {Location} with Id of " + "{(Id == 0 ? \"Bananas\" : Id)}"; } } }
public Monkey() { } public Monkey(int id, string name, string location) { Id = id; Name = name; Location = location; } public int Id { get; } = 0; public string Name { get; } = "Sofia"; public string Location { get; set; } = "South America"; public DayOfWeek MostActiveDay => Id == 0 ? Friday : Monday; public void Print() => WriteLine("We printed some stuff"); public string DisplayName => $"Monkey {Name} lives in {Location} with Id of " + "{(Id == 0 ? \"Bananas\" : Id)}"; }
public Monkey() { } public Monkey(int id, string name, string location) { Id = id; Name = name; Location = location; } public int Id { get; } = 0; public string Name { get; } = "Sofia"; public string Location { get; set; } = "South America"; public DayOfWeek MostActiveDay => Id == 0 ? Friday : Monday; public void Print() => WriteLine("We printed some stuff"); public string DisplayName => $"Monkey {Name} lives in {Location} with Id of " + "{(Id == 0 ? \"Bananas\" : Id)}"; }
// You could do this. … } catch(ResourceException e) { await Resource.LogAsync(res, e); // Now you can do this … } finally { if (res != null) await res.CloseAsync(); // … and this. }
// You could do this. … } catch(ResourceException e) when (e.Code == 0) { await Resource.LogAsync(res, e); // Now you can do this … } finally { if (res != null) await res.CloseAsync(); // … and this. }
// You could do this. … } catch(ResourceException e) when (myFilter(e)) { await Resource.LogAsync(res, e); // Now you can do this … } finally { if (res != null) await res.CloseAsync(); // … and this. }
3); //var squares = Select(range, x => x * x); //Not in scope var squares2 = range.Select(x => x * x); foreach (int num in squares2) { WriteLine(num); }
return; var star = UIImage.FromBundle("i_star_rate"); for (int i = 0; i < Subviews.Length; i++) { var imageView = Subviews[i] as UIImageView; if (imageView != null) { imageView.Image = (imageView.Tag <= value) ? star : null; } } } }
return; var star = UIImage.FromBundle("i_star_rate"); for (int i = 0; i < Subviews.Length; i++) { var imageView = Subviews[i] as UIImageView; imageView?.Image = (imageView.Tag <= value) ? star : null; } } }