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;
        }

 

posted @ 2021-09-28 09:41  韩梦芫  阅读(354)  评论(0编辑  收藏  举报