vendredi 3 avril 2015

C# - How to Get Access Modifiers of a Class Declaration Given an Object with Reflection

Let's say I have a class that's declared



internal sealed class Foo : Bar { /* banana banana banana */ }


And I want to have something like this:



public abstract class Bar {
protected Bar() {
if (!this.classDeclarationHasInternalAccess())
throw new Exception("Declare your class with internal access!");
}
}


Would this be possible at all?






Aucun commentaire:

Enregistrer un commentaire