title: 'ArrayList' does not contain a definition for 'GetAwaiter'
body: <p>I'm getting multiple errors. As I'm new to this async/await process. So with little research I've done this bit:-</p>
  
  <p>I've a function like:-</p>
  
  <pre><code>public async Task&lt;JsonResult&gt; GetMultipleTblResult(AdminBundle aBundleFetch)
      {
          if (!string.IsNullOrEmpty(aBundleFetch.ListType) &amp;&amp; aBundleFetch.ListType.Equals(Constants.Board))
          {
              ArrayList MainList = new ArrayList();
  
              aBundleFetch.ListType = Constants.Board;
              Func&lt;ArrayList&gt; functionBoard = new Func&lt;ArrayList&gt;(() =&gt; FetchTableDataAsync(aBundleFetch)); // Getting Error (Cannot implicitly convert type 'System.Threading.Tasks.Task&lt;System.Collections.Generic.IEnumerable&lt;System.Collections.ArrayList&gt;&gt;' to 'System.Collections.ArrayList')
              ArrayList resBoard = await Task.Factory.StartNew&lt;ArrayList&gt;(functionBoard);
  
              aBundleFetch.ListType = Constants.Classes;
              Func&lt;ArrayList&gt; functionClass = new Func&lt;ArrayList&gt;(() =&gt; FetchTableDataAsync(aBundleFetch)); // Getting Error (Cannot implicitly convert type 'System.Threading.Tasks.Task&lt;System.Collections.Generic.IEnumerable&lt;System.Collections.ArrayList&gt;&gt;' to 'System.Collections.ArrayList')
              ArrayList resClass = await Task.Factory.StartNew&lt;ArrayList&gt;(functionClass);
  
              aBundleFetch.ListType = Constants.ClassSubject;
              Func&lt;ArrayList&gt; functionClassSubject = new Func&lt;ArrayList&gt;(() =&gt; FetchTableDataAsync(aBundleFetch)); // Getting Error (Cannot implicitly convert type 'System.Threading.Tasks.Task&lt;System.Collections.Generic.IEnumerable&lt;System.Collections.ArrayList&gt;&gt;' to 'System.Collections.ArrayList')
              ArrayList resClassSubject = await Task.Factory.StartNew&lt;ArrayList&gt;(functionClassSubject);
  
              aBundleFetch.ListType = Constants.ClassMaterial;
              Func&lt;ArrayList&gt; functionClassMaterial = new Func&lt;ArrayList&gt;(() =&gt; FetchTableDataAsync(aBundleFetch)); // Getting Error (Cannot implicitly convert type 'System.Threading.Tasks.Task&lt;System.Collections.Generic.IEnumerable&lt;System.Collections.ArrayList&gt;&gt;' to 'System.Collections.ArrayList')
              ArrayList resClassMaterial = await Task.Factory.StartNew&lt;ArrayList&gt;(functionClassMaterial);
  
  
              MainList.Add(resBoard);
              MainList.Add(resClass);
              MainList.Add(resClassSubject);
              MainList.Add(resClassMaterial);
  
              var jsonSerialiser = new JavaScriptSerializer();
              var json = jsonSerialiser.Serialize(MainList);
  
              return new JsonResult { Data = json, JsonRequestBehavior = JsonRequestBehavior.AllowGet };
          }
          else
              return new JsonResult { Data = "", JsonRequestBehavior = JsonRequestBehavior.AllowGet };
      }
  </code></pre>
  
  <p>From my FetchTableDataAsync function I want to return a List of arraylists and send them over to GetMultipleTblResult :-</p>
  
  <pre><code>public async Task&lt;IEnumerable&lt;ArrayList&gt;&gt; FetchTableDataAsync(AdminBundle abundleList)
      {
          AdminBundle abundle = new AdminBundle();
          string innerMesage = string.Empty;
          if (Session["AdminBundle"] != null)
              abundle = (AdminBundle)Session["AdminBundle"];
  
          ArrayList BulkList = null;
          abundle.ListType = abundleList.ListType;
  
          if (!string.IsNullOrEmpty(abundleList.ListType))
          {
              using (SMContext db = new SMContext())
              {
                  switch (abundleList.ListType)
                  {
                      case "Category":
                          List&lt;Category&gt; CategoryList = null;
                          CategoryList = db.CatObj.Where(x =&gt; x.Status_Info == Constants.StatusInfoOne).ToList();
                          BulkList.Add(CategoryList);
                          break;
                      //Class Starts
                      case "Board":
                          List&lt;Board&gt; BoardList = null;
                          BoardList = db.BoardObj.Where(x =&gt; x.Status_Info == Constants.StatusInfoOne).ToList();
                          BulkList.Add(BoardList);
                          break;
                      default:
                          break;
                          //Main default Ends
                  }
              }
          }
  
          return await BulkList; //Getting Error 'ArrayList' does not contain a definition for 'GetAwaiter' and no extension method 'GetAwaiter' accepting a first argument of type 'ArrayList' could be found (are you missing a using directive or an assembly reference?)
      }
  </code></pre>
  
  <p>Basically I want to return set of multiple lists asynchronously from later function(FetchTableDataAsync) to previous function(GetMultipleTblResult) and then pass it to my angular.js file in JSON format.</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>So with help of @JohnWu I've done this bit:-</p>
  
  <pre><code>    [HttpPost]
      [LogInFilter]
      public JsonResult GetMultipleTblResult(AdminBundle aBundleFetch)
      {
          if (!string.IsNullOrEmpty(aBundleFetch.ListType) &amp;&amp; aBundleFetch.ListType.Equals(Constants.Board))
          {
              Task&lt;AllTblListClass&gt; AllTblObj = GetTableDataAsync(aBundleFetch);
  
              //var jsonSerialiser = new JavaScriptSerializer();
              //var json = jsonSerialiser.Serialize(AllTblObj);
  
              return new JsonResult { Data = "", JsonRequestBehavior = JsonRequestBehavior.AllowGet };
          }
          else
              return new JsonResult { Data = "", JsonRequestBehavior = JsonRequestBehavior.AllowGet };
      }
  
      public async Task&lt;AllTblListClass&gt; GetTableDataAsync(AdminBundle abundleList)
      {
          if (!string.IsNullOrEmpty(abundleList.ListType) &amp;&amp; abundleList.ListType.Equals(Constants.Board))
          {
              return new AllTblListClass
              {
                  BoardObj = await FetchBoardsAsync(),
                  ClsObj = await FetchClassAsync(),
                  ClsSubObj = await FetchClassSubAsync(),
                  MatTypeObj = await FetchMaterialTAsync(),
                  ClassSubMatRelationObj = await FetchClassSubMatRelAsync()
              };
  
          }
  
          else
          {
              return new AllTblListClass { };
          }
      }
  
      public async Task&lt;List&lt;ClassSubMatRelation&gt;&gt; FetchClassSubMatRelAsync()
      {
          using (SMContext db = new SMContext())
          {
              return await Task&lt;List&lt;ClassSubMatRelation&gt;&gt;.Run(() =&gt; db.ClassSubMatRelationObj.Where(x =&gt; x.Status_Info == Constants.StatusInfoOne).ToList()); // It executes untill here and then sleeps for endless time.
          }
      } //I'm not writing all functions as it will create a long question
  </code></pre>
  
  <p>But on this line of code:-</p>
  
  <pre><code>return await Task&lt;List&lt;ClassSubMatRelation&gt;&gt;.Run(() =&gt; db.ClassSubMatRelationObj.Where(x =&gt; x.Status_Info == Constants.StatusInfoOne).ToList());
  </code></pre>
  
  <p>The execution sleeps and nothing happens. There isn't any Error or Exception generating.</p>