System.Net.Http: missing from namespace? (using .net 4.5)

后端 未结 16 2328
我寻月下人不归
我寻月下人不归 2020-11-27 17:57

TL; DR: I\'m new to this language and have no idea what I\'m doing

here is my class so far:

using System;
using System.Collections.Generic;
using Sys         


        
16条回答
  •  盖世英雄少女心
    2020-11-27 18:10

    HttpClient lives in the System.Net.Http namespace.

    You'll need to add:

    using System.Net.Http;
    

    And make sure you are referencing System.Net.Http.dll in .NET 4.5.


    The code posted doesn't appear to do anything with webClient. Is there something wrong with the code that is actually compiling using HttpWebRequest?


    Update

    To open the Add Reference dialog right-click on your project in Solution Explorer and select Add Reference.... It should look something like:

    enter image description here

提交回复
热议问题