. NET gets JSON from the network interface address, then resolves to object (ii)

Source: Internet
Author: User

To tidy up the code, this is the second way to read the JSON and then deserialize it into an object with the following code:

1  Public StaticOrder GetOrderInfo (string_tid,string_orderno)2 {3     Try4     {5StringBuilder serviceurl =NewStringBuilder (); 6Serviceurl.append ("Http://10.10.10.10/queryOrderTwo?");7Serviceurl.appendformat ("tid={0}&tname=&email=&employeeno=&corpcode=&servicecode=&pagenum=&pagesize= &producttype=&datefrom=&dateto=&datetype=&sono={1}", _tid, _orderno);8         string_result =Excuteget (serviceurl.tostring ());9         returnJsonconvert.deserializeobject<order>(_result);Ten     } One     Catch(Exception e) A     { -Addlog (_tid,"Get order List exception:"+ E.message.tosql (),"getorderlist"); -         return NULL; the     } -}
The Excuteget method is different from the first,
1  Public Static string Excuteget (string  URL)2{3     var request = ( HttpWebRequest) webrequest.create (URL); 4     var response = (HttpWebResponse) request. GetResponse (); 5     return New StreamReader (response. GetResponseStream ()). ReadToEnd (); 6 }

. NET gets JSON from the network interface address, then resolves to object (ii)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.