c# - TempData value implicitly cast from List<string> to string[] after RedirectToAction() -
i using tempdata allow error message displayed after redirect. compatibility, using list<string> add messages list of errors in notificationhelper class: if (tempdata["errornotification"] == null) { tempdata["errornotification"] = new list<string> { message }; } else { var data = (list<string>) tempdata["errornotification"]; data.add(message); tempdata["errornotification"] = data; } inside controller, fill tempdata error message , before return redirecttoaction() call, tempdata contains dictionary record list<string> (to exact: system.collections.generic.list`1[system.string] ) value right after call, inside terms() function, value becomes array ( system.string[] ). [httpget] public iactionresult terms() { return view(); } [httpget] public iactionresult index() { notificationhelper.adderrornotification("error!", tempdata); return redirecttoaction("terms...