I have created class called ExcelMethods contains:
public class ExcelMethods
{
public string DestinationPath { get; set; }
public List<MyUsers> LoadExcelFile()
{
//My code
}
Now into my MainViewModel I want to set DestinationPath and call LoadExcelFile():
public class MainViewModel
{
public ExcelMethods _em;
public MainViewModel()
{
_em.SourcePath = @"\\abc.test\\folderA";
}
private void LoadExcel_Executed(object obj)
{
_em.LoadExcelFile();
}
}
But I'm getting error:
System.NullReferenceException: 'Object reference not set to an instance of an object.'