using statement in c# code example
Example 1: using in c#
//doing with using function
using (var font1 = new Font("Arial", 10.0f))
{
byte charset = font1.GdiCharSet;
}
//or
using var font1 = new Font("Arial", 10.0f);
byte charset = font1.GdiCharSet;
Example 2: using statement c#
using (var reader = new StringReader(manyLines))
{
string? item;
do {
item = reader.ReadLine();
Console.WriteLine(item);
} while(item != null);
}