public SpeechType(string value) { Enum.TryParse(typeof(SpeechTypeEnum), value, out var result); Value = (SpeechTypeEnum?)result ?? throw new InvalidEnumAggregateException("SpeechType should be valid and not empty"); }
public SpeechType(int value) { if (!Enum.IsDefined(typeof(SpeechTypeEnum), value)) { throw new InvalidEnumAggregateException(ErrorCode.InvalidEnum, $"{value} is not valid for SpeechType"); } Value = (SpeechTypeEnum)Enum.ToObject(typeof(SpeechTypeEnum), value); }
private SpeechType(SpeechTypeEnum value) { Value = value; }