The BasicTypes.xsd from the GML schema includes the following:
<simpleType name="SignType">
<annotation>
<documentation>
gml:SignType is a convenience type with values "+" (plus) and "-" (minus).
</documentation>
</annotation>
<restriction base="string">
<enumeration value="-"/>
<enumeration value="+"/>
</restriction>
</simpleType>
The code generator (sparx enterprise architect) is generating the following:
namespace OGC.GML.BasicTypes {
/// <summary>
/// gml:SignType is a convenience type with values "+" (plus) and "-" (minus).
/// </summary>
public enum SignType : int {
-,
+
}
}
Ofcourse, i can’t have – and + as enum keys. So my question is:
How would i define a Dicionary object to satisfy the schema as it is? Or is there a better way? Please give code example.
It looks like these people are using an array.
Here’s a sample of how to use a dictionary. What a dictionary basically does is it maps one object to another, in this case, string to int, you can always use different types for the keys and values if you like.
EDIT: I’ve updated it again
Now you can use a static class like so
and you’ll have to type
OGC.GML.BasicTypes.SignType.Values["+"]Or, you can use an instance class
which will allow `new OGC.GML.BasicTypes.SignType()[“+”]’
and even if BasicTypes is a class instead of a namespace, it’s still possible to put more Enums and Sub-Classes inside of it, but that might not be the ideal solution, depending on the purpose of the namespace.