here is the sample.

namespace USCrime2006and2007
{
    class Program
    {
        static void Main(string[] args)
        {
            GetData aa = new GetData();
            aa.GetFertilityData();
        }


    }

    class GetData
    {
        public GetData()
        {
            context = new UnitedNationsGenderInfo2007Container(new Uri("https://api.datamarket.azure.com/UnitedNations/GenderInfo2007/v1/"));

         // context = new UnitedNationsGenderInfo2007Container(new Uri("https://api.datamarket.azure.com/UnitedNations/GenderInfo2007/v1/Values?$filter=DataSeriesId%20eq%20%2713%27&$skip=500"));
            context.IgnoreMissingProperties = true;
            context.Credentials = new NetworkCredential("support-v-jayao@hotmail.com", "SBrjzkexSLcghuUyE3m+MsvwMSbBkobP2Wt58Lf5rxU");

        }
        private UnitedNationsGenderInfo2007Container context;

             //    public method that returns a list of fertility data
        public IList<Values> GetFertilityData()
        {
            IEnumerable<Values> query = context.Values.Where(fertility => fertility.DataSeriesId == "13").OrderBy(fertility => fertility.CountryName);
           // IEnumerable<Values> query = context.Values.;
            try
            {
                return query.ToList<Values>();
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error: {0}", ex.Message);
                return null;
            }  // end try
        }  // end function 
    }
}

 

posted on 2013-08-19 10:35  aking96  阅读(214)  评论(0编辑  收藏  举报