1
Answer

Require custom attributes at compile time

Photo of t

t

19y
2.3k
1
Hi, I'd like to make a custom attribute required at compile-time basically it is a custom attribute that sits on a class. I have an abstract class called ScreenControl, and I want every subclass of ScreenControl to have to provide this custom attribute on its class definition my current solution only applies at run-time - which is to have an assertation that 'this.getType()' provides the desired custom attribute in the ScreenControl constructor. Is there a way to make it a compile-time error(/warning) not to provide the custom attribute on types deriving from my class?

Answers (1)

0
Photo of Vulpes
NA 98.3k 1.5m 13y
None of those functions are anything to do with ASP.NET as such though they can be called from it (using the Platform Invoke mechanism in the case of the first two).

Briefly:

* LoadLibrary is an unmanaged function which loads a dll into a process's address space.

* CoCreateInstance is an unmanaged funmction which creates a COM object using its Class Id (CLSID).

* CreateObject is a VB library function which creates a COM object using its Program Id (ProgID).

* Assembly.Load is a .NET method which loads an assembly at runtime.