Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public enum EduTypePublicEnum
- {
- [RMSEnumItem("1", "Properties.Resources.SEduAlumn")]
- Alumn,
- [RMSEnumItem("2", "Properties.Resources.SEduProfesor")]
- Profesor,
- [RMSEnumItem("3", "Properties.Resources.SEduAll")]
- All
- }
- public class EduTypePublic : RMSEnum<EduTypePublicEnum> { };
- public EduAvisosForm()
- {
- InitializeComponent();
- this.myComboBox.DataSource = Edu.Consts.EduTypePublic.Enums;
- this.myComboBox.DisplayMember = "Alumn";
- this.myComboBox.ValueMember = "Alumn";
- }
- public abstract class RMSEnum<TEnumType>
- {
- protected RMSEnum();
- public static string CodeList { get; }
- public static string[] Codes { get; }
- public static string DescriptionList { get; }
- public static string[] Descriptions { get; }
- public static object[] Enums { get; }
- public static string Code(TEnumType value);
- public static string Description(string code);
- public static string Description(TEnumType value);
- public static TEnumType Enum(string code);
- }
- this.myComboBox.DisplayMember = "Value";
- this.myComboBox.ValueMember = "Key";
- this.myComboBox.DataSource =
- Enum.GetValues(typeof(EduTypePublicEnum))
- .Cast<EduTypePublicEnum>()
- .Select(e => new {
- Key = e.ToString(), // possibly read localized string
- Value = e
- }).ToList();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement