Code:
using System.Configuration;
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
String counter = ConfigurationManager.AppSettings["counter"].ToString();
Console.WriteLine(counter);
}
}
}
Code:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="counter" value="15"/>
</appSettings>
</configuration>
Unhandled Exception: System.NullReferenceException: Object reference not set to
an instance of an object.
I am a bit tired so I quess there is some stupid mistake I am making here but can you help???