0 out of 1 rated this helpful - Rate this topic

Compiler Error CS0698

A generic type cannot derive from 'class' because it is an attribute class

Any class that derives from an attribute class is an attribute. Attributes are not allowed to be generic types.

The following sample generates CS0698:

// CS0698.cs
class C<T> : System.Attribute  // CS0698
{
}
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
OverCome
There is a way to overcome.

e.g.

interfaceITranslationAttribute<DB_COLUMN_TYPE, PROPERTY_TYPE>

{

DB_COLUMN_TYPE GetValue(I_DB_Factory Factory, PROPERTY_TYPE PropertyValue);

}

[global::System.AttributeUsage(AttributeTargets.Property, Inherited = false, AllowMultiple = false)]

public class TranslationClientIDAttribute:Attribute, Translation.ITranslationAttribute <string,long>

{

public string GetValue(I_DB_Factory Factory, long PropertyValue) {return ""; }

}