Can't extend CodeGroup

  • Thread starter Thread starter D. Bron
  • Start date Start date
D

D. Bron

Forum,

Why can't I extend System.Security.Policy.CodeGroup? I need to create a
custom code group to associate with my custom permission, but when I try to
compile, I get the following error:

'System.Security.Policy.CodeGroup.CodeGroup()' is inaccessible due to
its protection level

From the documentation availble at:

http://msdn.microsoft.com/library/default.asp?url=/library/
en-us/cpref/html/frlrfsystemsecuritypolicycodegroupclasstopic.asp

and

http://dotnet.di.unipi.it/Content/sscli/docs/doxygen/fx/bcl/
codegroup_8cs-source.html

I believe I should be able to extend this class.

-D. Bron
 
D.Bron,

The CodeGroup class is abstract which means you can derive from it
without
any problem, just as long as there is a public och protected constructor
which
you can call. The error you are getting is telling you that the default
constructor
(the one without any parameters) is not accessible, but if you look at the
documentation for the class then you find a public constructor

public CodeGroup(
IMembershipCondition membershipCondition,
PolicyStatement policy
);

This is the constructor you need to call to init the base class of your own
derived
class.

Hope this helps,

//Andreas
 
Back
Top