我在做一个c#访问配置文件数据的小测试,但是在写的过程中断点调试时,总是提示:“访问配置文件.Program.GetConfigValue(string, string)”: 并非所有的代码路径都返回值”。文件在d盘当中,断点位置是在foreach的结束括号处。下面是代码,还请各位高手哥哥姐姐多多指教
using System;using System.Collections.Generic;using System.Linq;using System.Text;
namespace 访问配置文件{ class Program { static void Main(string[] args) { } static string GetConfigValue(string filename, string itemname) { string[] lines = System.IO.File.ReadAllLines(@"d:/2.ini", Encoding.Default); foreach (string strs in lines) { string[] str = strs.Split('='); }
} }}