Why default form class template makes it public ?
I use Visual C# Express 2008 and when I create a new Form it is created as public.
From what I know a public class is visible outside the assembly which contains it.
I cannot see any reason to make it public; am I missing something ? My attention was captured by that access modifier because in a project I had to cancel that 'public' for a poor design in other classes it used.
Just wondering if I did something bad.
Thanks
Filippo
Danatas GerviPosted Oct 4, 2009, 4:11 AM
This is not so important, I think,
But you said "paradigm" …. :-)
You think that your program is the first program on the Earth? Only you program will use other assemblies? The Visual Studio developers are thinking same as you. :-)
So have a look at your Form1 as a part of other really big application… In this case (working in the team, developing the big project) you will be asked to write your code in DLL assembly, and file Progam.cs may be in other (not yours) solution...
Filippo MartinelliPosted Oct 2, 2009, 2:53 AM
Danatas GerviPosted Oct 1, 2009, 11:09 AM
You free for changing any modificator.
Everything in .Net is assembly (even executable file) and can be used from other assembly.
But assembly without any public class – has no use – is not it?
So, the template adds form (first class in program) and makes it public. Later – do what you need for "good" design.
;-)