]> granicus.if.org Git - handbrake/commitdiff
WinGui: Updated EnumHelper with another helper method.
authorsr55 <sr55.hb@outlook.com>
Sun, 9 Oct 2011 16:56:31 +0000 (16:56 +0000)
committersr55 <sr55.hb@outlook.com>
Sun, 9 Oct 2011 16:56:31 +0000 (16:56 +0000)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4278 b64f7644-9d1e-0410-96f1-a4d463321fa5

win/CS/HandBrake.ApplicationServices/Functions/EnumHelper.cs

index ad565f0b7723bf573af44ad16c94b1a5c697780d..8147f527fe5ff96a50c9d74926b05aea7cc929b3 100644 (file)
@@ -6,6 +6,8 @@
 namespace HandBrake.ApplicationServices.Functions\r
 {\r
     using System;\r
+    using System.Collections.Generic;\r
+    using System.Collections.ObjectModel;\r
     using System.ComponentModel;\r
     using System.ComponentModel.DataAnnotations;\r
     using System.Reflection;\r
@@ -68,5 +70,25 @@ namespace HandBrake.ApplicationServices.Functions
 \r
             throw new ArgumentOutOfRangeException("The Description for the enum was not recognized.");\r
         }\r
+\r
+        /// <summary>\r
+        /// Get a list of string names for each enum value.\r
+        /// </summary>\r
+        /// <param name="enumType">\r
+        /// The enum type.\r
+        /// </param>\r
+        /// <typeparam name="T">\r
+        /// The type of the enum\r
+        /// </typeparam>\r
+        /// <returns>\r
+        /// A collection of strings that represent all the enum values\r
+        /// </returns>\r
+        public static IEnumerable<string> GetEnumDisplayValues(Type enumType)\r
+        {\r
+            var strings = new Collection<string>();\r
+            foreach (T e in Enum.GetValues(enumType))\r
+                strings.Add(GetDisplay(e));\r
+            return strings;\r
+        }\r
     }\r
 }\r