I have a working code but I would like to convert a block of code into a class a just call the classs. See code below.
DataTable results = dataAccess.Billing.GetDataTable(selectQuery);
// Convert Table to List
List<Service> serviceLines = new List<Service>();
serviceLines = (from DataRow dr in results.Rows
select new Service()
MemberNbr = dr["MEMBER_NBR"].ToString(),
AffNbr = dr["AFF_NBR"].ToString(),
AmtAllowP = Convert.ToDecimal(dr["AMTALLOW_P"]),
AmtCharge = Convert.ToDecimal(dr["AMTCHARGE"])
Can I remove this block of code and make a class or constant in another file so it is easy to maintain and just call it?