Quantcast
Channel: Visual Studio General Questions forum
Viewing all articles
Browse latest Browse all 21115

using System; - 'System' : symbol cannot be used in a using-declaration

$
0
0

I downloaded this Microsoft sample and no matter what I do I can't make it work. I created the project as both a CLR Console Application and a CLR Empty Project, I always get the "using System;" statement refused with a "System : symbol cannot be used in a using-declaration". I am using Visual Studio 2010 and have many applications working which do not use namespaces. This is the first time I am using namespaces. I spent all day on this because I want to use WebRequest. Thanks for any help anyone can give me. Here is the sample I am trying to build:

using System;
using System.Net;
using System.IO;

namespace MakeAGETRequest_charp
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class Class1
{
static void Main(string[] args)
{
string sURL;
sURL = "http://www.microsoft.com";

WebRequest wrGETURL;
wrGETURL = WebRequest.Create(sURL);

WebProxy myProxy = new WebProxy("myproxy",80);
myProxy.BypassProxyOnLocal = true;

       wrGETURL.Proxy = WebProxy.GetDefaultProxy();

Stream objStream;
objStream = wrGETURL.GetResponse().GetResponseStream();

StreamReader objReader = new StreamReader(objStream);

string sLine = "";
int i = 0;

while (sLine!=null)
{
i++;
sLine = objReader.ReadLine();
if (sLine!=null)
Console.WriteLine("{0}:{1}",i,sLine);
}
Console.ReadLine();
}
}
}


Viewing all articles
Browse latest Browse all 21115

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>