Hello,
I'm writing a C# class library that may be called by non-.Net
applications. The main class of this class libray is a ServicedCompone nt
so that non-.Net application can call this class as a standard COM+
component. Now, I want that class to be a singleton. Once loaded, the
values moslty never change.
I tried using this pattern:
public sealed class Singleton
{
private static readonly Singleton instance = new Singleton();
private Singleton(){}
public static Singleton Instance
{
get
{
return instance;
}
}
}
However, it throws an exception complaining about ServicedCompone nt
thats needs a public constructor.
The error raised is:
An unhandled exception of type
'System.Enterpr iseServices.Reg istrationExcept ion' occurred in
system.enterpri seservices.dll
Additional information: Invalid ServicedCompone nt-derived classes were
found in the assembly.
(Classes must be public, concrete, have a public default constructor,
and meet all other ComVisibility requirements)
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
I'm writing a C# class library that may be called by non-.Net
applications. The main class of this class libray is a ServicedCompone nt
so that non-.Net application can call this class as a standard COM+
component. Now, I want that class to be a singleton. Once loaded, the
values moslty never change.
I tried using this pattern:
public sealed class Singleton
{
private static readonly Singleton instance = new Singleton();
private Singleton(){}
public static Singleton Instance
{
get
{
return instance;
}
}
}
However, it throws an exception complaining about ServicedCompone nt
thats needs a public constructor.
The error raised is:
An unhandled exception of type
'System.Enterpr iseServices.Reg istrationExcept ion' occurred in
system.enterpri seservices.dll
Additional information: Invalid ServicedCompone nt-derived classes were
found in the assembly.
(Classes must be public, concrete, have a public default constructor,
and meet all other ComVisibility requirements)
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Comment