System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); //打开config文件

            config.AppSettings.Settings["username"].Value = “username”;         //写入

            config.Save(ConfigurationSaveMode.Modified);                                //保存
            
           
string username = config.AppSettings.Settings["username"].Value ;          //读出

posted on 2010-10-08 13:31  赤色彗星  阅读(232)  评论(0编辑  收藏  举报