C# Compiler Errors and Warn ...


Visual C# Reference: Errors and Warnings
Compiler Error CS0698

Error Message

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
{
}
Tags :


Community Content

Sioln
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 ""; }

}

Tags :

Page view tracker