当前位置: 首页>>代码示例>>C#>>正文


C# WebClient.ToString方法代码示例

本文整理汇总了C#中System.Net.WebClient.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# WebClient.ToString方法的具体用法?C# WebClient.ToString怎么用?C# WebClient.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Net.WebClient的用法示例。


在下文中一共展示了WebClient.ToString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MainForm

 public MainForm()
 {
     if (pingURL("http://yesit.com.au") == true)
     {
         string json = new WebClient().DownloadString("http://yesit.com.au/bvsc.php");
         if (json.ToString() != "1")
         {
             DialogResult result = MessageBox.Show("You are no longer authorized to run this diag.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
             if (result == DialogResult.OK)
             {
                 Environment.Exit(0);
             }
         }
     }
     InitializeComponent();
 }
开发者ID:sicness0,项目名称:diag,代码行数:16,代码来源:Form1.cs

示例2: next

        public ActionResult next(string n)
        {
            var json = new WebClient().DownloadString("https://gist.githubusercontent.com/WillemLabu/34cfb50187ec334c48ee/raw/cb46400505afd82d9e354b591ad71d97f07613be/jobs.json");
                Trace.TraceError(json.ToString());
                var objects = JObject.Parse(json.ToString()); // parse as array
                var subject = JArray.Parse(objects.GetValue("jobs").ToString());
                List<Jobs> jobs = new List<Jobs>();

                foreach (var root in subject)
                {

                    var data = JObject.Parse(root.ToString());
                    Jobs job = new Jobs();
                    job.client = data.GetValue("client").ToString();
                    job.jobNumber = data.GetValue("job-number").ToString();
                    job.jobName = data.GetValue("job-name").ToString();
                    job.due = data.GetValue("due").ToString();
                    job.status = data.GetValue("status").ToString();

                    jobs.Add(job);

                }

                if (Int32.Parse(n) >= jobs.Count() || Int32.Parse(n) < 0)
                {
                ViewBag.Last = 0;
                return View("Index",jobs.GetRange(0, 10));
            }

                ViewBag.Last = Int32.Parse(n);
            return View("Index",jobs.GetRange(Int32.Parse(n), 10));
        }
开发者ID:mapitsim,项目名称:JobList,代码行数:32,代码来源:JobsController.cs

示例3: Index

        // GET: Jobs
        public ActionResult Index(String SearchString)
        {
            var json = new WebClient().DownloadString("https://gist.githubusercontent.com/WillemLabu/34cfb50187ec334c48ee/raw/cb46400505afd82d9e354b591ad71d97f07613be/jobs.json");
            Trace.TraceError(json.ToString());
            var objects = JObject.Parse(json.ToString()); // parse as array
            var subject = JArray.Parse(objects.GetValue("jobs").ToString());
            List<Jobs> jobs = new List<Jobs>();

            foreach (var root in subject)
            {

                var data = JObject.Parse(root.ToString());
                Jobs job = new Jobs();
                job.client = data.GetValue("client").ToString();
                job.jobNumber = data.GetValue("job-number").ToString();
                job.jobName = data.GetValue("job-name").ToString();
                job.due = data.GetValue("due").ToString();
                job.status = data.GetValue("status").ToString();

                jobs.Add(job);

            }

            var joblist = from m in jobs
                          select m;
            if (!String.IsNullOrEmpty(SearchString))
            {
                jobs = jobs.Where(b => b.jobName.ToUpper().Contains(SearchString.ToUpper())).ToList();

                return View(jobs);

            }
            ViewBag.Last = 0;
            list = jobs;
            return View(jobs.GetRange(0,10));
        }
开发者ID:mapitsim,项目名称:JobList,代码行数:37,代码来源:JobsController.cs


注:本文中的System.Net.WebClient.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。