say i have a code
using System;
using System.Windows.Forms;
class TestApp
{
static void Main()
{
Console.WriteLine("Testing! 1, 2, 3");
MessageBox.Show("Hello...");
}
}
will the using System
& System.Windows.Forms
means load all types (within those namespaces) at runtime, although im using only to print on console and show a messagebox ?
and also will there be any memory consumed for loading those required types (Console
& MessageBox
) at the execution time...
[ and there will be some block of code (within Console
) still unutilized by the source code but still will it be loaded ? ]
so any clue on what's happening behind the scenes (atleast for the above 10 lines of code)would be helpfull...
using
statements are compile time only statements allowing the compiler to find referenced types without specifying the fully qualified name at every use, they will not make anything load at runtime that otherwise wouldn't load if referencing the same type directly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With