If all the implementing classes will reside in the same assembly as the
class containing the static function, you could use the internal keyword on
the constructor, such that it cannot be used outside the assembly.



Lidor Wyssocky
Software Infrastructure and Tools
NDS Technologies Israel
E-Mail: [EMAIL PROTECTED]
Phone:  972-2-589-4801
Fax:    972-2-589-4900

 -----Original Message-----
From:   Michael Potter [mailto:[EMAIL PROTECTED]]
Sent:   Thu, August 01, 2002 05:11
To:     [EMAIL PROTECTED]
Subject:        [ADVANCED-DOTNET] Need a C# pattern that returns an
Interface

I have a static method that will return an object of
IMyInterface. It will create the best 1 of many
mutually exlusive objects that implement IMyInterface.
 The object created depends upon the available
hardware resources.

The objects should not be created outside of the one
static function. How do I hide the constructor of the
objects (that implement IMyInterface) from the rest of
the world and yet, allow them to be exposed to the one
static creation method?

Any ideas?
Mike P



__________________________________________________
Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.yahoo.com

You can read messages from the Advanced DOTNET archive, unsubscribe from
Advanced DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced 
DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to