Hi I was going through some examples in C# and came across some code similar to below :
private void WriteData(string filePath)
{
using var writer = new System.IO.StreamWriter(filePath);
//Logic to write data here
}
I want to know what is the use and significance of using
in variable declaration.
Also how is it different from simple variable declaration :
var writer = new System.IO.StreamWriter(filePath);