日期:2014-05-17  浏览次数:20981 次

请问c#中什么功能相当于php中的lang
<?php
$lang['commonName']='功能';
?>
使用
<table>
<tr>
<td width="125px;"><strong>{lang commonName}</strong></td>
</tr>
请问c#中有类似于改功能的用法吗


------解决方案--------------------
都一样 的
例子
HTML code
<%@ Page Language="C#" AutoEventWireup="true" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server"> 
  public Hashtable ht = new Hashtable();
  public System.Collections.Generic.Dictionary<String, String> ht2 = new System.Collections.Generic.Dictionary<string, string>();
  protected void Page_Load(object sender, EventArgs e)
  {
    ht.Add("commonName", "功能1");
    ht2.Add("commonName", "功能2");
    ht["xx"] = "test1";
    ht2["xx"] = "test2";
  }
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
  <title>无标题页</title>
</head>
<body>
  <form id="form1" runat="server">
  <%=ht["commonName"]%>
  <%=ht2["commonName"]%>
  <%=ht["xx"]%>
  <%=ht2["xx"]%>
  </form>
</body>
</html>

------解决方案--------------------
个人Dictionary用的比较多 给你个例子
http://www.cnblogs.com/linzheng/archive/2010/12/13/1904709.html