C#C
C#3y ago
Cinthia

❔ Change Null Values

I'm working on a project in my course, where I need to change all values ​that come from the API to my list that are NULL to "N/A".
I made a default value but my professor didn't accept it, he said it's not the most professional way, the code below is close to what he asked, but I still couldn't get to the point. And everything I think about is going to turn into a very big or complicated code, which they already said it's not, I need help!

public class Root
{
public Name name { get; set; }
public string cca3 { get; set; }
public Currencies currencies { get; set; }
public List<string> capital { get; set; }
public string region { get; set; }
public string subregion { get; set; }
public Languages languages { get; set; }
public List<double> latlng { get; set; }
public double area { get; set; }
public string flag { get; set; }
public Maps maps { get; set; }
public int population { get; set; }
public List<string> timezones { get; set; }
public List<string> continents { get; set; }
public Flags flags { get; set; }
public Gini gini { get; set; }

public string giniYear { get; set; }

public double giniValue { get; set; }

public static string ReturnNull(string Value)
{
return Value != null ? Value : "n/d";
}
}
Was this page helpful?