标签:.config .text str write c# tin utf-8 命名 app
App.config:
<?xml version="1.0" encoding="utf-8"?> <configuration> <appSettings> <add key="factory" value="Abstract_Dactory.SummerSkinFactory"/> </appSettings> </configuration>
C#:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Configuration;////导入命名空间(记得在解决方案资源管理器里的“引用”中添加“System.Configuration”) namespace Abstract_Dactory { class Program { static void Main(string[] args) { //读取配置文件 string factoryType =ConfigurationManager.AppSettings["factory"]; Console.WriteLine(factoryType); Console.ReadKey(); } } }
标签:.config .text str write c# tin utf-8 命名 app
原文地址:http://www.cnblogs.com/lbonet/p/7169648.html