Hi there.
I've
just created a new class and everything compiles fine. But now
Intellisense doesnt list the class. I've re-checked the namespace and
using lines over and over. I've closed the forms and re-opened and ive
closed the solution and re-opened. Still doesnt work.
Is there a way i can sort this out
This used to happen in VS2003 but usually closing the files or solution would fix the problem.
I've just checked the Class viewer and the class viewer shows the class exactly where i want it to be, yet still nothing in Intellisense.
-Stark

Intellisense is missing a class.
Alemus
You can ‘control’ just about anything by modifying the templates that are used. You’ll need to get used to XML.
Classes need to be public or private or protected or abstract or static or sealed or internal or protected internal as necessary to their purposes. In general, with so many options, who can tell what a class should be The default is internal.
jobethm
Sure.
Make a class internal, unless it must be called from outside the assembly.
Make a class member private, unless it must be called from outside the class.
It's as simple as that.
The reasons are manifold. In the following discussion, I use the term "interface" to refer to a class or C# interface, or any accessible method or field:
* A public interface must not be changed, unless you want to (and can!) recompile all its depending assemblies. If you do change a public interface, that means you need to identify all its depending assemblies, which can take a lot of work. If the public interface is in fact not used by anything outside its assembly, you just did a load of work for nothing.
* When you are trying to use someone else's class library, you have to look at ALL its public interfaces to see what's available. If there's a bunch of interfaces in there that are declared public that are only really used as implementation, again that's a lot of extra work you have to go through, for no gain.
* When writing a class library, you should of course document all its public interfaces. If you habitually make ALL a class libraries public - even the ones only used for internal implementation - then you must document them. What would you write for the documentation for a class that was only really being used internally "Do not use this class" If so, that's a rather big clue that the class should be declared "internal".
* When writing unit tests for a class library, you should write a test for each of its public interfaces. If you declare interfaces public that could be internal, again you've given yourself a lot of extra work.
The list could go on - but I'm suprised that there could even be any debate about this! Data hiding has been a fundamental part of good programming style for decades.
Anyway, one of the best programming style guides is "Code Complete" by Steve McConnell, which talks about such things. But there are very many more good guides on the internet, as I'm sure you are aware.
yingfeng
I clicked and dragged the desired method from the class viewer to my form and built. Then it tells me the class is "innaccessible due to its protection level".
So i realise...when you create a class it doesnt make the class public by default!!!!!!!!
wtf has this been changed
Douglas R
Russell Mangel
Classes should be internal by default. And now they are.
avm
Thanks for the input and reccommendations. And once again, keep up the good work. Matthew, you guys have done a fantastic job with the VS2005 IDE, there is of course, room for improvement, but like they say: a masterpiece is never finished. I would be exhilirated to see better support for template customization in future releases.
Peter, thanks for you contributions also, they have been of great value to me!
Dimmi3
C:\Program Files\Microsoft Visual Studio 8\VC#\Snippets\1033\Visual C# is the place for snippets. I just started bulling my way around.
C:\Program Files\Microsoft Visual Studio 8\Common7\IDE has folders for each language. Anything named ‘xxxTemplate’ is a good bet.
The ‘smooth’ way is via help. Search on Templates and Startup Kits.
wy125
Actually, you are ONE consumer. There are many others. Unfortunately for you, what most people will want is not what you happen to want. Microsoft have chosen the most common requirement as the default. I'm sure you would agree that is the logical thing to do, even if the default doesn't happen to be the one you want.
But hey! At least you can change the default! This is in fact what I did (via a different, more fiddly method) for VS2003 to make all the classes internal by default. Fortunately for me, I don't have to do that any more for VS2005... Think yourself lucky. It was a lot more hassle to change with VS2003!
Steven Khiem
And yes, almost all the classes i write form part of external libraries. For me it is the neatest way to do it. I dont know what encapsulation is and quite frankly, right now i dont care. The interface used to work the way i wanted it to, and it doesnt any more. I'm the consumer and what i want is what is important.
I really dont see any argument further than that.
nikkah
Anyways, love your work, keep it up.
GeorgeT
About modifying templates, where can i obtain more information regarding this
Ot2
Matthew –
Yes, I agree. I would phrase it “in general, classes should be as hidden as possible.”
Chace
>>My perspective is that a class should be public by default, as in my personal experience 99% of the classes i create are required to be public.
Do you mean that 99% of the classes that you write are exposed from class libraries
I'm extremely unconvinced that can be true! Do you ever use the "internal" keyword for classes
I'm wondering if you misunderstood or weren't aware of what it means for a class to be marked "internal" and have therefore assumed that you need to make all the classes "public".
Having to make 99% of your classes public seems like either you only write class libraries with lots of public interface and very little encapsulation, or you have misunderstood something!
Desperate Dan
Hi Matthew –
Perhaps you could post some ‘recommendations’