I have a java library that I want to bind to in Xamarin. The library contains an enum with more than one property, defined below:
public enum WriteType {
WITH_RESPONSE(WRITE_TYPE_DEFAULT, PROPERTY_WRITE),
WITHOUT_RESPONSE(WRITE_TYPE_NO_RESPONSE, PROPERTY_WRITE_NO_RESPONSE),
SIGNED(WRITE_TYPE_SIGNED, PROPERTY_SIGNED_WRITE);
public final int writeType;
public final int property;
WriteType(final int writeType, final int property) {
this.writeType = writeType;
this.property = property;
}
}
When compiling, Visual studio generates the enum as class, but the WriteByte constructor has "int" return type (i.e. treated as a function). It generates an error:
"CS0542 'WriteType': member names cannot be the same as their enclosing type"
How to properly bind to enum with more than one property?
It turns out that visual studio changes the first character of member names to capital on binding. This aparently conflicts with the enum name itself.
I changed the member name and now binds successfully (no error).