I am working on a .net core project where i have to define dictionary in a class and fetch its value into another class.but i should not use static variable at the the time of dictionary declaration.... here below is my code sample
Public classA{
public Dictionary<string, string> sample1{ get; set; }
public void method()
{
sample1= new Dictionary<string, string>();
sample1.Add("Key", text);
}
}
and in another class
public classB
{
private classA _dataHelper;
public void getvalue()
{
string value = _dataHelper.sample1["Key"];
}
}
here in classB the value im getting from Dictionary is null...how to solve this problem