where T : class

  • Thread starter Thread starter Shapper
  • Start date Start date
S

Shapper

Hello,

I have the following method:

public IQueryable<T> Find(Expression<Func<T, Boolean>> criteria);

But I get the error:

The type or namespace name 'T' could not be found (are you missing a using directive or an assembly reference?)

I changed it to:

public IQueryable<T> Find(Expression<Func<T, Boolean>> criteria) where T : class

But where is not recognized ... It works fine if I use:

void Find<T>(Expression<Func<T, Boolean>> criteria) where T : class;

In this case "where T : class" does not seem to even be necessary ...

Could someone help me in solving this?

Thank You,

Miguel
 
Hello,

I have the following method:

public IQueryable<T> Find(Expression<Func<T, Boolean>> criteria);

But I get the error:

The type or namespace name 'T' could not be found (are you missing a using directive or an assembly reference?)

I changed it to:

public IQueryable<T> Find(Expression<Func<T, Boolean>> criteria) where T : class

But where is not recognized ... It works fine if I use:

void Find<T>(Expression<Func<T, Boolean>> criteria) where T : class;

In this case "where T : class" does not seem to even be necessary ...

Could someone help me in solving this?

Thank You,

Miguel

Oops, I missed the Find<T>. Solved.

Thanks,
Miguel
 
Back
Top