diff options
author | sr55 <[email protected]> | 2011-10-09 16:56:31 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2011-10-09 16:56:31 +0000 |
commit | c800a995fda7b9516a585a1fb3f5daeda3a86f80 (patch) | |
tree | 30859370bb6d1d22cf40dc40252ebd817f3d4be3 /win | |
parent | 8308b4260755eb6623c9cc03709e5fc3fc1e452d (diff) |
WinGui: Updated EnumHelper with another helper method.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4278 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win')
-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;
+ }
}
}
|