I have a WebClient
like this:
WebClient _webClient = new WebClient
{
UseDefaultCredentials = true,
Encoding = System.Text.Encoding.UTF8,
You can do it like this. You have to split the property and its value by a colon (:
):
WebClient _webClient = new WebClient
{
UseDefaultCredentials = true,
Encoding = System.Text.Encoding.UTF8,
Headers = new WebHeaderCollection
{
"user-agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)"
}
};