bits and bytes of my life experiences
Why Sealed Classes?
The main purpose of a sealed class to take away the inheritance feature from the user so they cannot derive a class from a sealed class. One of the best usage of sealed classes is when you have a class with static members. For example, the Pens and Brushes classes of the System.Drawing namespace.
The Pens class represent the pens for standard colors. This class has only static members. For example, Pens.Blue represents a pen with blue color. Similarly, the Brushes class represents standard brushes. The Brushes.Blue represents a brush with blue color.
So when you're designing your application, you may keep in mind that you have sealed classes to seal user's boundaries ;).
By Mahesh Chand @ www.c-sharpcorner.comthis.Close();
Form2 nfrm = new Form2();
if(nfrm.ShowDialog() == DialogResults.OK)
{
this.label1.Text = nfrm.textBox1.Text;
}
The .NET Framework FAQ was first posted in July 2000, and is regularly updated. It covers the fundamentals of the .NET Framework including assemblies, garbage collection, security, interop with COM and remoting. Newcomers to the .NET framework may wish to read the FAQ from top to bottom as a tutorial. More experienced practitioners may prefer to consult the contents list for topics of particular interest.
This FAQ was inspired by discussions on the DOTNET mailing list. The list has now been split into several DOTNET-X lists - for details see http://discuss.develop.com/.
Christophe Lauer has translated the FAQ into French. Royal has translated the FAQ into Chinese.
If you like this FAQ, you might be interested in my C# FAQ for C++ Programmers.