You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.1 KiB
47 lines
1.1 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Model
|
|
{
|
|
class Game
|
|
{
|
|
private string name;
|
|
|
|
public Game(string name)
|
|
{
|
|
this.name = name;
|
|
}
|
|
public readonly Collection<Die> ListDice { get; set; }
|
|
private List<Die> listDice = new List<Die>(); //encapsulation des collections voir les videos partie 2
|
|
public string Name
|
|
{
|
|
get
|
|
{
|
|
return name;
|
|
|
|
}
|
|
set
|
|
{
|
|
//Indique si une chaîne spécifiée est null, vide ou se compose uniquement d'espaces blancs
|
|
if (string.IsNullOrWhiteSpace(value))
|
|
{
|
|
throw new ArgumentException("Enter a name", nameof(value));
|
|
}
|
|
name = value;
|
|
}
|
|
}
|
|
|
|
public void AddDice(Die die)
|
|
{
|
|
listDice.Add(die);
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|