Im pretty new to C# and I hope to get some help here.
The mypath
variable is a placeholder in this case.
The class is included by using Programm.src;
This is my code where I want to initialize my input_excel_path
variable at the mainWindow1
object.
The outcome in the compiler
error CS0747 : Invalid initializer member declarator and compiler error CS0165: Use of unassigned local variable 'name'.
MainWindow mainWindow1 = new MainWindow()
{
mainWindow1.m_input_excel_path = mypath;
};
This is my class:
class MainWindow
{
public string m_input_excel_path = String.Empty;
public MainWindow(string input_excel_path )
{
m_input_excel_path = input_excel_path;
}
}