CHAPTER 1 THE PHILOSOPHY OF .NET
Because your code file is importing the System.Windows.Controls namespace, the compiler is able to
resolve the Bitmap class as a member of this namespace. If you did not import the
System.Windows.Controls namespace, you would be issued a compiler error. However, you are free to
declare variables using a fully qualified name as well.
// Not listing System.Drawing namespace!
using System;
class MyGUIBuilder
{
public void BuildUI()
{
// Using fully qualified name.
System.Windows.Controls.Button btnOK =
new System.Windows.Controls.Button();
...
}
}
While defining a type using the fully qualified name provides greater readability, I think you’d agree
that the C# using keyword reduces keystrokes. In this text, I will avoid the use of fully qualified names
(unless there is a definite ambiguity to be resolved) and opt for the simplified approach of the C# using
keyword.
Howev