使用容器的类在 AmountList 和 PGRow 上抛出一个错误,上面写着AmountList is inaccessible due to its protection level
编码
public virtual ActionResult getAjaxPGs(string SP = null, string PG = null)
{
if (SP != null)
{
Container container = new Container();
var PGList = from x in db.PG_mapping
where x.PG_SUB_PROGRAM == SP
select x;
container.PARow = PGList.Select(x => new { x.PG }).Distinct().ToArray();
container.AmountList = from x in db.Spend_Web
where x.PG == PG
group x by new { x.ACCOUNTING_PERIOD, x.PG, x.Amount } into pggroup
select new { accounting_period = pggroup.Key.ACCOUNTING_PERIOD, amount = pggroup.Sum(x => x.Amount) };
return Json(container, JsonRequestBehavior.AllowGet);
}
return View();
}
public class Container
{
Array PARow;
Array AmountList;
}
我尝试将课程公开,我是否必须做其他事情才能使课程可以访问getAjaxPGs
??