diff options
-rw-r--r-- | win/CS/HandBrake.ApplicationServices/Functions/EnumHelper.cs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Functions/EnumHelper.cs b/win/CS/HandBrake.ApplicationServices/Functions/EnumHelper.cs index ad565f0b7..8147f527f 100644 --- a/win/CS/HandBrake.ApplicationServices/Functions/EnumHelper.cs +++ b/win/CS/HandBrake.ApplicationServices/Functions/EnumHelper.cs @@ -6,6 +6,8 @@ namespace HandBrake.ApplicationServices.Functions
{
using System;
+ using System.Collections.Generic;
+ using System.Collections.ObjectModel;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Reflection;
@@ -68,5 +70,25 @@ namespace HandBrake.ApplicationServices.Functions throw new ArgumentOutOfRangeException("The Description for the enum was not recognized.");
}
+
+ /// <summary>
+ /// Get a list of string names for each enum value.
+ /// </summary>
+ /// <param name="enumType">
+ /// The enum type.
+ /// </param>
+ /// <typeparam name="T">
+ /// The type of the enum
+ /// </typeparam>
+ /// <returns>
+ /// A collection of strings that represent all the enum values
+ /// </returns>
+ public static IEnumerable<string> GetEnumDisplayValues(Type enumType)
+ {
+ var strings = new Collection<string>();
+ foreach (T e in Enum.GetValues(enumType))
+ strings.Add(GetDisplay(e));
+ return strings;
+ }
}
}
|