private static void PrintValueEnumValue(StringBuilder sb, IValueEnumOperandValue valueOperandValue, DisassemblyOptions options) { sb.Append(valueOperandValue.Key); if (valueOperandValue.Value is IList <object> valueList && valueList.Count > 0) { sb.Append(" "); foreach (var v in valueList) { PrintOperandValue(sb, v, options); } } }
public T GetSingleEnumValue <T>() where T : Enum { IValueEnumOperandValue v = (IValueEnumOperandValue)Value; if (v.Value.Count == 0) { // If there's no value at all, the enum is probably something like ImageFormat. // In which case we just return the enum value return((T)v.Key); } else { // This means the enum has a value attached to it, so we return the attached value return((T)((IValueEnumOperandValue)Value).Value[0]); } }