enums

How to put an Enum into a List, using PythonNET and C#.NET?

前提是你 提交于 2021-02-08 02:35:23
问题 I have a NET library I'm using from Python with PythonNET and can't figure out how to put an enum into a List. It seems Python converts the enum to an integer that won't fit the List datatype. Here's an example: import clr from System.Collections.Generic import List from System import Array, Enum import MyLibrary enum = List[MyLibrary.ResultType] #no errors here enum.Add(MyLibrary.ResultType.PV) #TypeError: No method matches given arguments #and just typing MyLibrary.ResultType.PV I get this

XJC does not generate enum inside xs:union

核能气质少年 提交于 2021-02-07 13:15:42
问题 I have several XSD files containing structures like the following: <xs:complexType name="SomeThing" abstract="false"> <xs:sequence> <xs:element name="id" type="schema2:SomeIdTypeClass" minOccurs="1" maxOccurs="1"/> <xs:element name="myType" type="schema1:MyType" minOccurs="1" maxOccurs="1"/> </xs:sequence> </xs:complexType> <xs:simpleType name="MyType"> <xs:union> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="APPLE"/> <xs:enumeration value="ORANGE"/> <xs:enumeration

XJC does not generate enum inside xs:union

穿精又带淫゛_ 提交于 2021-02-07 13:14:03
问题 I have several XSD files containing structures like the following: <xs:complexType name="SomeThing" abstract="false"> <xs:sequence> <xs:element name="id" type="schema2:SomeIdTypeClass" minOccurs="1" maxOccurs="1"/> <xs:element name="myType" type="schema1:MyType" minOccurs="1" maxOccurs="1"/> </xs:sequence> </xs:complexType> <xs:simpleType name="MyType"> <xs:union> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="APPLE"/> <xs:enumeration value="ORANGE"/> <xs:enumeration

XJC does not generate enum inside xs:union

最后都变了- 提交于 2021-02-07 13:14:02
问题 I have several XSD files containing structures like the following: <xs:complexType name="SomeThing" abstract="false"> <xs:sequence> <xs:element name="id" type="schema2:SomeIdTypeClass" minOccurs="1" maxOccurs="1"/> <xs:element name="myType" type="schema1:MyType" minOccurs="1" maxOccurs="1"/> </xs:sequence> </xs:complexType> <xs:simpleType name="MyType"> <xs:union> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="APPLE"/> <xs:enumeration value="ORANGE"/> <xs:enumeration

What is the usage of default when the switch is for an enum?

送分小仙女□ 提交于 2021-02-07 11:15:22
问题 Suppose I have an enum Color with 2 possible values: RED and BLUE : public enum Color { RED, BLUE } Now suppose I have a switch statement for this enum where I have code for both possible values: Color color = getColor(); // a method which returns a value of enum "Color" switch (color) { case RED: ... break; case BLUE: ... break; default: break; } Since I have code block for both possible values of the enum, what is the usage of default in the above code? Should I throw an exception if the

What is the usage of default when the switch is for an enum?

蹲街弑〆低调 提交于 2021-02-07 11:14:57
问题 Suppose I have an enum Color with 2 possible values: RED and BLUE : public enum Color { RED, BLUE } Now suppose I have a switch statement for this enum where I have code for both possible values: Color color = getColor(); // a method which returns a value of enum "Color" switch (color) { case RED: ... break; case BLUE: ... break; default: break; } Since I have code block for both possible values of the enum, what is the usage of default in the above code? Should I throw an exception if the

What determines which name is selected when calling ToString() on an enum value which has multiple corresponding names?

蹲街弑〆低调 提交于 2021-02-06 15:20:59
问题 What determines which name is selected when calling ToString() on an enum value which has multiple corresponding names? Long explanation of question follows below. I have determined that this not determined uniquely by any of: alphabetical order; declaration order; nor, name length. For example, consider that I want to have an enum where the numeric values correspond directly to a practical use, (e.g. rgb values for color). public enum RgbColor { Black = 0x000000, Red = 0xff0000, Green =

What determines which name is selected when calling ToString() on an enum value which has multiple corresponding names?

倖福魔咒の 提交于 2021-02-06 15:19:18
问题 What determines which name is selected when calling ToString() on an enum value which has multiple corresponding names? Long explanation of question follows below. I have determined that this not determined uniquely by any of: alphabetical order; declaration order; nor, name length. For example, consider that I want to have an enum where the numeric values correspond directly to a practical use, (e.g. rgb values for color). public enum RgbColor { Black = 0x000000, Red = 0xff0000, Green =

What determines which name is selected when calling ToString() on an enum value which has multiple corresponding names?

半腔热情 提交于 2021-02-06 15:19:12
问题 What determines which name is selected when calling ToString() on an enum value which has multiple corresponding names? Long explanation of question follows below. I have determined that this not determined uniquely by any of: alphabetical order; declaration order; nor, name length. For example, consider that I want to have an enum where the numeric values correspond directly to a practical use, (e.g. rgb values for color). public enum RgbColor { Black = 0x000000, Red = 0xff0000, Green =

Binary operator '==' cannot be applied to two operands

微笑、不失礼 提交于 2021-02-06 14:59:17
问题 I have a class with the protocol Equatable . The class looks like this: class Item: Equatable { let item: [[Modifications: String]] init(item: [[Modifications: String]]) { self.item = item } } func ==(lhs: Item, rhs: Item) -> Bool { return lhs.item == rhs.item } But this is giving me the error (see title). The property item was [[String: String]] before and there was no problem and I have no idea how to fix this. I tried googling and searching all over SO but with no luck.. The enum is just a