Find INI File From application path and Read INI File in Compact framework C#
i Want To Find Confic.INI File From Application path and i want get values, i mean read INI file data to string...
My Code {
StreamReader Sdr=new StreamReader( System.IO.Path.GetDirectoryName( S开发者_C百科ystem.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase)+"\Confic.INI")
//HERE I AM NOT GETTING APPLICATION PATH AND FILE NAME)//
String data=file.readline(); }
Please help me..
Thank You
To find application dir I use:
Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)
So you can use:
string assname=Assembly.GetExecutingAssembly().Location; // This is the assembly's name
Path.GetDirectoryName(assname); // This is the assembly dir
string filename=Path.Combine(dir,"Config.ini");
string[] ini = File.ReadAddLines(filename);
精彩评论