A Device can have a ConnectedBattery
sometimes its value is null,
I try to display some details of the Device like:
allDetails.Add("Conected to " + ConnectedBattery.Name);
If ConnectedBattery
is null, I want to return ConnectedBattery.Name as "none".
I tried Doing this in GameObjects (Which both Battery and Device inherite from)
public string Name
{
get
{
if (this == null)
{
return "none";
}
return _name;
}
set { _name = value; }
}
is something like this even possible? or will is just have to do a null check in the Details