Question: generic type constraint for method

I have a question: does oxygene support generic type constraints on a the method level or only on the class level? And if yes, what’s the syntax and also does this work for global functions/procedures?

ex. something of the form:

function MyFunc([autoclosure] code: Expression<Func<T>>):Boolean where T is struct;

Hello Fredy,
“T” must be defined after the method name;
there is a “;” missing;
and “struct” is a C# thing.

Your definition should look like this:
function MyFunc<T>([autoclosure] code: Expression<Func<T>>):Boolean; where T is record;

I just have errors about “autoclosure” and “Expression” that are not defined.

Ah, of course, it’s too early this morning :slight_smile:
thanx

Sorry, Patrick, I forgot to tell you: you need to include System.Linq.* in the uses.