0

I have a generic method:

Public bool Insert<T>(object data) 
{
Bool isEmpty()=> ?
}

I need to check if data = default(T). T could be a list, int, datetime Any ideas?

Guy Z
  • 683
  • 3
  • 8
  • 24
  • 3
    `EqualityComparer.Default.Equals(data, default(T))` (just `Equals(data, default(T))` would do it, but that unnecessarily boxes value types) – canton7 Jul 21 '20 at 13:06
  • We've found some other questions which ask the same thing which already have great answers, so we've added links to those other questions and prevented people from adding yet more answers here. It's OK that you didn't manage to find these yourself: it's a lot easier to find related questions when you know what the answer is! – canton7 Jul 21 '20 at 13:16

0 Answers0