Re: Creating a "public only" constructor
Chris Anderson <[email protected]> Mon, 6 Apr 2009 09:50:38 +0100
| Newsgroups | gmane.comp.windows.devel.dotnet.advanced |
|---|---|
| Message-ID | <[email protected]> |
How's this:
Define a new conditional compilation symbol when in the Debug configuration (or create a new configuration that includes it) : CHECKCTOR
then use code similar to:
#if CHECKCTOR
[Obsolete("This should not be used from within project Foo", true)]
#endif
public ClassName()
{...}
(or just use DEBUG instead of CHECKCTOR of course, but then you will not be able to compile a debug version of the library for use by external libraries)
Chris
________________________________
From: Discussion of advanced .NET topics. on behalf of Dean Cleaver
Sent: Mon 06/04/2009 09:15
To: [email protected]
Subject: Re: [ADVANCED-DOTNET] Creating a "public only" constructor
Frans,
If it were a new design yes - but it's not. The code generation has allowed for this separate server capability, but I fear it cannot be utilised fully because the code was historically never designed to work with it, and without hundreds of hours of trawling through the current codebase it can't be successfully changed to a class factory type scenario.
Dino
===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives