Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Making Rootobject in model class while consuming WEB APIs through HTTPClient or RESTSHARP

$
0
0

Why is there a Rootobject method in the following code. I got it from the xamarin form samples HTTPClient project. WHen do we have to make it? DO we need it for a User model class?

public class Earthquake
    {
        public string eqid { get; set; }
        public float magnitude { get; set; }
        public float lng { get; set; }
        public string src { get; set; }
        public string datetime { get; set; }
        public float depth { get; set; }
        public float lat { get; set; }

        public string Summary {
            get{ return String.Format ("Date: {0}, Magnitude: {1}", datetime.Substring(0, 10), magnitude); }
        }

        public override string ToString ()
        {
            return String.Format ("{0}, {1}, {2}, {3}", lat, lng, magnitude, depth);
        }
    }

    public class Rootobject
    {
        public Earthquake[] earthquakes { get; set; }
    }

Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>