[Solved] how to return the list of integer values to a method in c# [closed]


Why don’t you create a class and return a list of this class. For example

public class BuildData
{
    public int BuildQty {get;set;}
    public int FailQty {get;set;}
    public int ShiftHours {get;set;}
}

And then create a list

List<BuildData> BuildDataList = new List<BuildData>();

You can then loop around your data like;

while (ResultSet.Read())
{

     BuildData data = new BuildData();
     data.BuildQty = Convert.ToInt64(ResultSet["BUILD_QTY"];
     data.FailQty = Convert.ToInt64(ResultSet["FAIL_QTY"];
     data.ShiftHours = Convert.ToInt64(ResultSet["SHIFT_HOURS "];
     BuildDataList.Add(data);  
}

return BuildDataList;

So you are returning a list of BuildData rather than a List for just one of your columns.

1

solved how to return the list of integer values to a method in c# [closed]