C# 读取.conf文件内容
/// <summary> /// 读取config文件内容 /// </summary> /// <param name="Path">文件路径</param> public void ReadConfigContent(string path) { FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); StreamReader sr = new StreamReader(fs, Encoding.Default); string content = sr.ReadToEnd(); string[] ContentLines = content.Split( new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries ) .Where(x=> !x.Contains("#")).ToArray(); int count = 0; }