Re: Creating a "public only" constructor
Dean Cleaver <[email protected]> Mon, 6 Apr 2009 22:12:56 +1200
| Newsgroups | gmane.comp.windows.devel.dotnet.advanced |
|---|---|
| Message-ID | <8E588B65FD82DF448592A3219102C395035CD2EE73@SXSLAKL001.xceptionsoftware.com> |
Yeah - that's about the only choice - however it will be manual, as all the default constructors I want to block are not code generated :( -----Original Message----- From: Discussion of advanced .NET topics. [mailto:[email protected]] On Behalf Of Chris Anderson Sent: Monday, 06 April 2009 20:51 To: [email protected] Subject: Re: [ADVANCED-DOTNET] Creating a "public only" constructor 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 =================================== View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives