1

Not sure if the description is clear, I'll explain by example:

    class A
    {
       int x;
    }

    class B : A { }
    
    void Something<T where T:A>(T item)
    {
        Console.WriteLine(item.x);
    }

The

T where T:A

is not a valid syntax. I want to achieve the same thing. It's possible in that way in class/interface declerations. Is there an alternative here also?

Yahav
  • 211
  • 3
  • 4

1 Answers1

0

just change the syntax

void Something<T>(T item) where T:A 
{
    .....
}
Derviş Kayımbaşıoğlu
  • 28,492
  • 4
  • 50
  • 72