DWTD
DWTD
CC#
Created by DWTD on 2/4/2024 in #help
CS 0101 , CS 0111 error[Solved]
this is code:
// C# 샘플 코드
using System;
using System.Net;
using System.Net.Http;
using System.IO;

namespace ConsoleApp1
{
class Program
{
static HttpClient client = new HttpClient();
static void Main(string[] args)
{
string url = "[api url]"; // URL
url += "?ServiceKey=" + "[api key]"; // Service Key
url += "&pageNo=1";
url += "&numOfRows=10";
url += "&dataType=XML";
url += "&fromTmFc=20171101";
url += "&toTmFc=20171129";

var request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "GET";

string results = string.Empty;
HttpWebResponse response;
using (response = request.GetResponse() as HttpWebResponse)
{
StreamReader reader = new StreamReader(response.GetResponseStream());
results = reader.ReadToEnd();
}

Console.WriteLine(results);
}
}
}
// C# 샘플 코드
using System;
using System.Net;
using System.Net.Http;
using System.IO;

namespace ConsoleApp1
{
class Program
{
static HttpClient client = new HttpClient();
static void Main(string[] args)
{
string url = "[api url]"; // URL
url += "?ServiceKey=" + "[api key]"; // Service Key
url += "&pageNo=1";
url += "&numOfRows=10";
url += "&dataType=XML";
url += "&fromTmFc=20171101";
url += "&toTmFc=20171129";

var request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "GET";

string results = string.Empty;
HttpWebResponse response;
using (response = request.GetResponse() as HttpWebResponse)
{
StreamReader reader = new StreamReader(response.GetResponseStream());
results = reader.ReadToEnd();
}

Console.WriteLine(results);
}
}
}
this is the error: Severity Code Description Project File Line Suppression Status Error CS0111 Type 'Program' predefines a member 'Main' with the same parameter type. Ei C:\Users[name]\source\repos\ei\ei\Form1.Designer.cs 12 active, Severity Code Description Project File Line Suppression Status Error CS0101 Namespace 'Program' already contains a definition for 'ConsoleApp1'. Ei C:\Users[name]\source\repos\Ei\Ei\Form1.Designer.cs 9 active
21 replies