Tech Off Post

Single Post Permalink

View Thread: How do I apply generic constraints to: void MyFunction<T1, T2>() {}?
  • User profile image
    dcuccia

    I've tried the following...

    void MyFunction<T1, T2>() where T1, T2 : struct {}

    void MyFunction<T1, T2>() where T1: struct , T2 : struct {}

    void MyFunction<T1, T2>() where T1: struct ,  where T2 : struct {}

    ...but alas, I'm stumped. Please help!