I have a feature that requires certain properties and a class to ensure that the class is given a type In which there is some special feature, how can I do it now:
public class test () {public test (some type obj) {if (! Obj.GetType () IsDefined (typeof (SomeAttribute), incorrect)) {new argument expression ("error"); }}}
But that means that I have not received any error in compiling time, but somewhere on the runtime, if there is no feature in obj. What method is there a way to specify in the declaration that there should be some feature in the parameter? So do I get a mistake, I compile while using the wrong parameters, or do I have to use the empty interface? No, there is no way of requiring any attribute - but you always write unit tests to scan through your assemblies.
It seems somewhat strange - can you give some more information about why you are using this plan? Perhaps another approach would be more appropriate, such as other parameters to describe additional data that you are interested in.
Comments
Post a Comment