Reputation: 2077
In my c# program I have this first line:
using System;
using System.Diagnostics;
using System.ComponentModel;
private const string TargetUrl = "http://www.TEST.com";
private const string TorAppLocation = @"C:\Program Files (x86)\test\Lis\lis.exe";
private static readonly string[] InstalledBrowsers
= new[]{"IExplore","Chrome","Firefox","Safari"};
static private Process _prc;
static private int _reqCounter = 0;
...
When I compile it returns error CS1518: Expected class, delegate, enum, interface, or struct.
How can I solve it?
Upvotes: 0
Views: 5247
Reputation: 5474
Please define your const and member field inside your class
class Program
{
private const string TargetUrl = "http://www.TEST.com";
private const string TorAppLocation = @"C:\Program File (x86)\test\Lis\lis.exe";
private static readonly string[] InstalledBrowsers
= new[]{"IExplore","Chrome","Firefox","Safari"};
static private Process _prc;
static private int _reqCounter = 0;
static void Main(string[] args)
{
//code here
}
}
Upvotes: 3
Reputation: 11317
You just forgot to define your const and other fields inside a class.
EDIT :
class Whatever {
private const string TargetUrl = "http://www.TEST.com";
private const string TorAppLocation = @"C:\Program Files (x86)\test\Lis\lis.exe";
private static readonly string[] InstalledBrowsers = new[]{"IExplore","Chrome","Firefox","Safari"};
static private Process _prc;
static private int _reqCounter = 0;
}
Upvotes: 3