BKS Saha

BKS Saha

  • NA
  • 44
  • 18.7k

How to convert one list to multidimensional array?

Dec 6 2017 4:04 AM
  1. public JsonResult AllListofMainDivisionDesignation() {       
  2. List<HrDesignation> designation = new List<HrDesignation>();   
  3.      var designationgroup = db.HrDesignationGroup.Where(p=>p.Rank==2).ToList();   
  4.      foreach (var des in designationgroup)   
  5.     {         var desig = db.HrDesignation.Where(i=> i.DesignationGroupId == des.DesignationGroupId).OrderBy(r => r.Rank).ToList();  
  6.  designation.AddRange(desig);}  
  7.  HrDesignation[][] arrays = designation.Select(a =>a.ToArray()).ToArray();    
  8.  return Json(arrays, JsonRequestBehavior.AllowGet);   
  9.  }  

Answers (8)