I wanted to create a class constructor that Telefono as a parameter a string to insert into a list
The compiler I reports the error: "cannot implicitly convert to void a string"
How can I fix?
public static class Telefono
{
public double LevelBattery { get; set; }
public List<String> NomeTelefono { get; set; }
public bool TelefonoON { get; set; }
public Telefono(string telefono)
{
telefono = NomeTelefono.Add(telefono); //ERROR!!!!
}
public void ON()
{
Random x = new Random();
int Batt = x.Next(100);
LevelBatty = Batt;
if (Levelbattery > 10)
TelefonoON = true;
else
{
Console.WriteLine("Ricaricare subito il telefono {0}. Batteria inferiore al 10%", NomeTelefono);
Console.ReadLine();
TelefonoON = false;
}
}