Hello all,
I'm in the process of trying to learn C# as with the continued Mono improvements it seems like a good language to learn (having dabbled in ANSI C, C++, PHP etc for a while now).
Anyway. I figured the best way to learn would be to try and write something useful. Part of that is readign & writing to a file. Writing is the easy part, However the value stored in the text file is an int, how can I read feed this into my application as an int as opposed to a string?
As a point of reference, the relevant section of code is below.
Code:
public int InstallDuration
{
get
{
TextReader ProdInfo = new StreamReader("ProdInfo.dat");
return ProdInfo.ReadLine();
ProdInfo.Close();
}
set
{
TextWriter ProdInfo = new StreamWriter("ProdInfo.dat");
ProdInfo.WriteLine(value);
ProdInfo.Close();
}
}
Any suggestions/links would be greatly appreciated