Skip to content

Commit

Permalink
Comments and simplification.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kinematics committed Jun 23, 2015
1 parent 7759860 commit b24b5b1
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions TallyCore/Utility/Enumerations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using System.Text.RegularExpressions;
using System.Threading.Tasks;


namespace NetTally
Expand Down Expand Up @@ -107,7 +105,11 @@ public static T GetValueFromDescription<T>(string description)
return default(T);
}


/// <summary>
/// Create a list of enums containing each of the enumerated values.
/// </summary>
/// <typeparam name="T">The enum type to create a list for.</typeparam>
/// <returns>Returns an IEnumerable list of enum values.</returns>
public static IEnumerable<T> EnumToList<T>()
{
Type enumType = typeof(T);
Expand All @@ -127,11 +129,14 @@ public static IEnumerable<T> EnumToList<T>()
return list;
}

/// <summary>
/// Create a list of the descriptions of each enum value of a given type.
/// </summary>
/// <typeparam name="T">The enum type to create a list for.</typeparam>
/// <returns>Returns a list of string descriptions for an enum type.</returns>
public static IEnumerable<string> EnumDescriptionsList<T>()
{
var enums = EnumToList<T>();

var enumDescrips = from Enum e in enums
var enumDescrips = from Enum e in EnumToList<T>()
select e.GetDescription();

return enumDescrips;
Expand Down

0 comments on commit b24b5b1

Please sign in to comment.