I am using a class
public partial class CashFlowIndicator:IEnumerable
{
public static void getCashFlowChartValues(int userid)
{
List<KeyValuePair<string, string>> chartValues=new List<KeyValuePair<string,string>>();
chartValues = cashFlowChart(userid);
}
public static List<KeyValuePair<string, string>> cashFlowChart(int userid)
{
//.............................
//..................................
List<KeyValuePair<string, string>> cashFlowItems = new List<KeyValuePair<string, string>>();
cashFlowItems.Add(new KeyValuePair<string, string>(a, b));
cashFlowItems.Add(new KeyValuePair<string, string>(c, d));
//.....................
return cashFlowItems;
}
}
The problem is while calling the function cashFlowChart, the variable “chartValues” is not getting assigned by the value returned…..
is there any solution?
Based on the method name – “getCashFlowChartValues”, and return type – “void”, here is my guess –
you need to move the definition of “chartValues” outside the methods and make it ‘static’ (as shown below) :