ConsoleApplication2.exe' does not contain a static 'Main' method suitable for an entry point

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
<p align=left><font face=Arial size=2></font> 
I have two class <font color="#0000ff" size=2>
<p align=left>
<div class=codeseg>
<div class=codecontent>
<div class=codesniptitle><span style="width:100% Code Block <font color="#0000ff" size=2>
<p align=left>class</font><font size=2> TestUrl
<p align=left>{
<p align=left></font><font color="#0000ff" size=2>public</font><font size=2> </font><font color="#0000ff" size=2>static</font><font size=2> </font><font color="#0000ff" size=2>void</font><font size=2> Main()
<p align=left>{
<p align=left></font><font color="#0000ff" size=2>string</font><font size=2> strOut;
<p align=left>CSDownloadURL web = </font><font color="#0000ff" size=2>new</font><font size=2> CSDownloadURL();
<p align=left>web.setURL1(</font><font color="#800000" size=2>"http://www.google.com"</font><font size=2>);
<p align=left>web.DownloadURL(</font><font color="#0000ff" size=2>out</font><font size=2> strOut);
<p align=left>Console.WriteLine(strOut);
<p align=left>}
<p align=left>} </font>
<p align=left> 
<p align=left>  </font>
<font size=2>
<p align=left> <font size=2>
<p align=left>
<div class=codeseg>
<div class=codecontent>
<div class=codesniptitle><span style="width:100% Code Block <font size=2><font size=2>
<p align=left>namespace Project5
<p align=left>{
<p align=left>using System;
<p align=left>using System.Text;
<p align=left>using System.IO;
<p align=left>using System.Net;
<p align=left>/// <summary>
<p align=left>/// Summary description for Class1.
<p align=left>/// </summary>
<p align=left>public class CSDownloadURL
<p align=left>{
<p align=left>private string m_strURL;
<p align=left>public void setURL1( string strURL )
<p align=left>{
<p align=left>m_strURL = strURL;
<p align=left>}
<p align=left>public void DownloadURL(out string strContents)
<p align=left>{
<p align=left>WebRequest req = WebRequest.Create(m_strURL);
<p align=left>WebResponse res = req.GetResponse();
<p align=left>int iTotalBuff = 0;
<p align=left>Byte[] Buffer = new Byte[128];
<p align=left>Stream stream = res.GetResponseStream();
<p align=left>iTotalBuff = stream.Read(Buffer, 0, 128);
<p align=left>StringBuilder strRes = new StringBuilder("");
<p align=left>while(iTotalBuff != 0)
<p align=left>{
<p align=left>strRes.Append(Encoding.ASCII.GetString(Buffer, 0, iTotalBuff));
<p align=left>iTotalBuff = stream.Read(Buffer, 0, 128);
<p align=left>}
<p align=left>strContents = strRes.ToString();
<p align=left>}
<p align=left>} </font></font>
<p align=left> 
<p align=left>why?
<p align=left>Thanks

<p align=left> </font></font>

View the full article
 
Back
Top