I have a enum and i am calling the methods inside the enum. THis is working fine in java , but i am anot able to covert it in c#
public enum RomanConverter {
a("a",1),
b("b",5),
c("c",10),
private String name;
private int value;
public String getName() {
return name;
}
//here i am setting the value
public void setName(String name) {
this.name = name;
}
public int getValue() {
return value;
}
public void setValue(int value) {
this.value = value;
}
RomanConverter(String name, int value){
this.name = name;
this.value = value;
}
// here is am getting the value
public static int getValueByRoman(String roman){
switch(roman){
case "a":
return RomanConverter.a.getValue();
case "b":
return RomanConverter.b.getValue();
case "c":
return RomanConverter.c.getValue();
default:
return 0;
}
}
}
I want to convert this code in the c#.I am using the [Descprtion] attribute to set the key and then assigning the value to the value. But it is giving me error "Expected class, delegate, enum, interface, or struct"