I got an error CS0305
with this piece of code. Is there a good way to do this ?
public class Filtre<T> : List<KeyValuePair<Filtre.Methode, object>>
{
public enum Methode
{
Id,
Keyword
}
}
I got an error CS0305
with this piece of code. Is there a good way to do this ?
public class Filtre<T> : List<KeyValuePair<Filtre.Methode, object>>
{
public enum Methode
{
Id,
Keyword
}
}
If you really want to keep the enum inside Filtre<T>
, then change the class signature as -
public class Filtre<T> : List<KeyValuePair<Filtre<T>.Methode, object>>
{
public enum Methode
{
Id,
Keyword
}
}
But does that make any sense? Think about it, does the value of T
by any means affect the enum Methode
? No. Rather its adding unnecessary friction in code.
Also, you cannot declare the enum as anything less accessible than public
, because then you will be making the base class List<KeyValuePair<Filtre<T>.Methode, object>>
less accessible than Filtre<T>
.
So, it will be better to declare the enum outside, and simplify the class signature -
public enum Methode
{
Id,
Keyword
}
public class Filtre<T> : List<KeyValuePair<Methode, object>>
{
//
}