Specify code contract on Func parameters?

Say I have the following

public T Example(Func<T> f)
{
     Contract.Requires(f != null);
     Contract.Requires(f() != null); // no surprise, this is an error
...
}

Is there any way to specify that my Func parameters must obey some contracts?

5
задан Scott Weinstein 30 October 2010 в 18:44
поделиться