using System;
using System.IO;
using System.Reflection;
class demonstration
{
int data_id = 0;
string filename = Path.GetDirectoryName (
Assembly.
GetEntryAssembly ( ).
Location ) +
"Data_ID.txt";
void demonstrate ( )
{
if ( File.Exists ( filename ) )
{
try
{
using ( StreamReader sr =
new StreamReader ( filename ) )
{
string line = sr.ReadLine ( );
if ( !String.IsNullOrEmpty ( line ) )
{
data_id = Convert.ToInt32 ( line );
}
}
}
catch
{
}
}
data_id++;
try
{
using ( StreamWriter sw = new StreamWriter ( filename,
false ) )
{
sw.WriteLine ( data_id );
}
}
catch
{
}
}
}