var client = new HttpClient();
client.DefaultRequestHeaders.UserAgent.ParseAdd("MyAgent/1.0");
There is also a TryParseAdd if you want to catch bad attempts at adding it and Add if you want to create the ProductInfoHeaderValue with a name and version number yourself.