I'm trying to create a simple webrequest for a json, i'm attempting to use the example on MSDN.
// Create a new 'Uri' object with the specified string.
Uri myUri =new Uri("http://www.contoso.com");
// Create a new request to the above mentioned URL.
WebRequest myWebRequest= WebRequest.Create(**myUri**);
// Assign the response object of 'WebRequest' to a 'WebResponse' variable.
WebResponse myWebResponse= **myWebRequest**.GetResponse();
I'm getting the following error;
A field initializer cannot reference the non-static field, method, or property
on the objects highlighted. (myUri and myWebRequest) Any idea's?
thanks