Hei, I have a method from a class in a custom library which I would like to restrict to be called only on a specific page, somehow using conditional methods. The problem is that I need a return value and conditional methods do not allow return other than void or 'out' parameters. Using a void method it works fine, but is there a way to accomplish this kind of conditional behavior and still return a value? Of course in the end I could manage like it is shown below, but I'm curious about other options.
My code now:
in the library:
public bool MyResult {get; private set;}
[Conditional("condition")]
public void MyConditionalMethod(...){
this.MyResult = DoSomethingElse();
}
in the page:
#define condition
bla bla bla
Thanks!