Is a 'type' but is used like a 'variable'. Передача в конструктор - C#
Формулировка задачи:
В методе пытаюсь передать значения конструктору. Выдает ошибку
'TimeSpender.DataBaseQueryes' is a 'type' but is used like a 'variable'
Подчеркивает 18 строку
Код в классе DataBaseQueryes
public void CheckSettings()
{
if (File.Exists("settings.xml") == true)
{
using (StreamReader rd = new StreamReader("settings.xml", System.Text.Encoding.UTF8))
{
string line;
string[] lines = { "", "", "" };
int i = 0;
while ((line = rd.ReadLine()) != null)
{
lines[i] = line;
i++;
}
string server = lines[0];
string username = lines[1];
string password = lines[2];
DataBaseQueryes(server, username, password);
}
}
} private string server;
private string username;
private string password;
// constructor
public DataBaseQueryes(string server, string username, string password)
{
this.server = server;
this.username = username;
this.password = password;
}Решение задачи: «Is a 'type' but is used like a 'variable'. Передача в конструктор»
textual
Листинг программы
var smth = new DataBaseQueryes(server, username, password);