From: sr55 Date: Sun, 9 Oct 2011 16:56:31 +0000 (+0000) Subject: WinGui: Updated EnumHelper with another helper method. X-Git-Tag: 0.9.6~190 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c800a995fda7b9516a585a1fb3f5daeda3a86f80;p=handbrake WinGui: Updated EnumHelper with another helper method. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4278 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- 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."); } + + /// + /// Get a list of string names for each enum value. + /// + /// + /// The enum type. + /// + /// + /// The type of the enum + /// + /// + /// A collection of strings that represent all the enum values + /// + public static IEnumerable GetEnumDisplayValues(Type enumType) + { + var strings = new Collection(); + foreach (T e in Enum.GetValues(enumType)) + strings.Add(GetDisplay(e)); + return strings; + } } }