using System.Collections.Generic;
using System.Linq;
namespace ACE.Entity.Enum.Properties
{
///
/// Static selection of client enums that are [AssessmentProperty]
/// These are properties sent to the client on id.
///
public static class AssessmentProperties
{
///
/// Method to return a list of enums by attribute type - in this case [AssessmentProperty] using generics to enhance code reuse.
///
/// Enum to list by [AssessmentProperty]
/// Type of the results
private static HashSet GetValues()
{
var list = typeof(T).GetFields().Select(x => new
{
att = x.GetCustomAttributes(false).OfType().FirstOrDefault(),
member = x
}).Where(x => x.att != null && x.member.Name != "value__").Select(x => (TResult)x.member.GetValue(null)).ToList();
return new HashSet(list);
}
///
/// returns a list of values for PropertyInt that are [AssessmentProperty]
/// PropertiesInt = GetValues();
///
/// returns a list of values for PropertyInt that are [AssessmentProperty]
///
public static HashSet PropertiesInt64 = GetValues();
///
/// returns a list of values for PropertyInt that are [AssessmentProperty]
///
public static HashSet PropertiesBool = GetValues();
///
/// returns a list of values for PropertyInt that are [AssessmentProperty]
///
public static HashSet PropertiesString = GetValues();
///
/// returns a list of values for PropertyInt that are [AssessmentProperty]
///
public static HashSet PropertiesDouble = GetValues();
///
/// returns a list of values for PropertyInt that are [AssessmentProperty]
///
public static HashSet PropertiesDataId = GetValues();
///
/// returns a list of values for PropertyInt that are [AssessmentProperty]
///
public static HashSet PropertiesInstanceId = GetValues();
}
}