Hadidi,
The first part is easy, and I'm sure you know the singleton pattern, so
there is no reason to repeat it here.
As for the second part, that's nearly impossible. If you are asking
for an IDE error, you are asking for a compile-time error, and there is no
way to do something like this. The best you could do is settle for a run
time error.
However, if you implement the singleton correctly, you will end up
making your constructor private, and you will have definite control over
the lifetime of the instance, and won't have to worry about someone else
creating the object.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)
Hadidi said:
I want to make a class that :
- will have one and only one object
- when you try to make another object of this class , an IDE error should
be
seen . like using undefined variable , or any thing like that ..