Writing a simple class in c# comes up with error "Not all code path return a value"
public class Genre
{
private string _name;
public string Name
{
get => _name;
set => _name = value;
}
}
Writing a simple class in c# comes up with error "Not all code path return a value"
public class Genre
{
private string _name;
public string Name
{
get => _name;
set => _name = value;
}
}
This syntax is a new addition to C#7, so the options are:
Use the old way:
public class Genre
{
private string _name;
public string Name
{
get { return _name; }
set { _name = value; }
}
}