可以和XML文件一样读取,或者使用
ConfigurationManager类来读取,see: NameValueCollection appSettings =
ConfigurationManager.AppSettings;
// Get the collection enumerator.
IEnumerator appSettingsEnum =
appSettings.Keys.GetEnumerator(); // Loop through the collection and
// display the appSettings key, value pairs.
int i = 0;
Console.WriteLine("App settings.");
while (appSettingsEnum.MoveNext())
{
string key = appSettings.Keys[i];
Console.WriteLine("Name: {0} Value: {1}",
key, appSettings[key]);
i += 1;
}
ConfigurationManager类来读取,see: NameValueCollection appSettings =
ConfigurationManager.AppSettings;
// Get the collection enumerator.
IEnumerator appSettingsEnum =
appSettings.Keys.GetEnumerator(); // Loop through the collection and
// display the appSettings key, value pairs.
int i = 0;
Console.WriteLine("App settings.");
while (appSettingsEnum.MoveNext())
{
string key = appSettings.Keys[i];
Console.WriteLine("Name: {0} Value: {1}",
key, appSettings[key]);
i += 1;
}
解决方案 »
- 用SQL语句如何获得表中的列名?
- ReportViewer HyperlinkTarget 属性问题
- ADO.NET中的select排序语句这样写有问题吗?是不是不支持
- 找个学习伙伴
- XmlDocument.Load("c:\1.xml") 打开时编码问题,如果1.xml是asc格式文件 含有中文,打开就有错误 怎么解决
- DateTime的麻烦问题
- .net类要封装成com的问题,救命啊,最后30分了,大家帮帮忙
- C#中如何调用数据库中的存储过程??
- 有报高程的朋友吗??
- 这个c#程序也编译不了,为啥,请帮助
- WinFrm的GridView末行加上汇总信息如何实现 希望高手指点 谢谢了
- webservice 双方如何实现一次交换多条记录?
在 C# 中使用设置
http://www.microsoft.com/china/msdn/library/langtool/vcsharp/SettingsCSRL.mspx?mfr=true
然后在程序里用ConfigurationManager对象来读取你设置的对应的结点里的值就可以了