C# passing values from one method to another

后端 未结 3 1871
北荒
北荒 2021-01-17 01:38

I am getting an error code in the result. code below. I am basically trying to get a data set from SingleColumn method and use it in SMA method. Bu

3条回答
  •  没有蜡笔的小新
    2021-01-17 02:26

    Each variable in C# is exists within a scope which is defined by curly braces. In your case the variable result is within the scope SingleCloumn.

    public static void SingleColumn(IEnumerable strs, int highNum)
    {
    
    }
    

    To use result in another scope, you can make "result" as a global variable. As I can see you have commented out

    //static public double results; 
    

    first un-comment it and remove var from

    var results = columnQuery.ToList();
    

    Hope this helps.

提交回复
热议问题