internal staticbool IsUnique<T>(IEnumerable<T> values)
var set = new HashSet<T>();
foreach (T item in values)
But I am getting a "Specified cast is not valid" in the foreach loop. My database field is tinyint and I thought that casting the T as Int16 would solve the issue (I already tried with string, Int32 and int), but it is not working.