estoy tratando lo siguiente:No se puede comparar T value1 con T value2 = default (T). ¿Por qué y cómo hacerlo en C#?
T value1 = el.value; // it's of type T already
T value2 = default(T);
if (value1 != value2) // gives the following error: Operator '!=' cannot be applied to operands of type 'T' and 'T'
{
// ...
}
Así que, ¿cómo podría comparar ambos valores? ¿Y por qué ocurre este error?
¡Gracias de antemano!
Asegúrese T ref nula implementa clases de tipo COMPARAR-ish, y el método o clase que define T tiene esas referencias en la declaración. – asawyer