KeyValuePair的使用
Dictionary<string, string> dc = new Dictionary<string, string>();
前台页面:
<div id="tb"> @if (ViewBag.data != null) { foreach (KeyValuePair<string, string> item in ((System.Collections.Generic.Dictionary<string, string>)ViewBag.data)) { <input type="hidden" name="@item.Key" value="@item.Value" /> } } </div>
作者:chenze 出处:https://www.cnblogs.com/chenze-Index/ 本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。 如果文中有什么错误,欢迎指出。以免更多的人被误导。 |