Hello!
Here I have two different Main called version 1 and version 2. Version 1 use
the using statement and
version 2 use local block which is {}
I wonder if version 1 and version 2 is functionally the same?
I mean it just a question of teste which one to use.
(Version 1)
public static void Main()
{
using (Font MyFont = new Font("Arial", 10.0f), MyFont2 = new
Font("Arial", 10.0f))
{
// use MyFont and MyFont2
} // compiler will call Dispose on MyFont and MyFont2
Font MyFont3 = new Font("Arial", 10.0f);
using (MyFont3)
{
// use MyFont3
} // compiler will call Dispose on MyFont3
}
(Version 2)
public static void Main()
{
{
Font MyFont = new Font("Arial", 10.0f), MyFont2 = new Font("Arial",
10.0f)
// use MyFont and MyFont2
}
{
Font MyFont3 = new Font("Arial", 10.0f);
// use MyFont3
}
}
//Tony