Removed the last traces of Windows Phone 7 and Xbox 360 support
git-svn-id: file:///srv/devel/repo-conversion/nusu@314 d2e56fa2-650e-0410-a79f-9358c0239efd
This commit is contained in:
parent
9a4a051100
commit
b1b1f02e6f
5 changed files with 6 additions and 816 deletions
|
|
@ -92,39 +92,7 @@ namespace Nuclex.Support {
|
|||
/// and cache the result.
|
||||
/// </remarks>
|
||||
public static TEnum[] GetValues<TEnum>() {
|
||||
#if XBOX360 || WINDOWS_PHONE
|
||||
return GetValuesXbox360<TEnum>();
|
||||
#else
|
||||
return (TEnum[])Enum.GetValues(typeof(TEnum));
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>Retrieves a list of all values contained in an enumeration</summary>
|
||||
/// <typeparam name="TEnum">
|
||||
/// Type of the enumeration whose values will be returned
|
||||
/// </typeparam>
|
||||
/// <returns>All values contained in the specified enumeration</returns>
|
||||
internal static TEnum[] GetValuesXbox360<TEnum>() {
|
||||
Type enumType = typeof(TEnum);
|
||||
if(!enumType.IsEnum) {
|
||||
throw new ArgumentException(
|
||||
"The provided type needs to be an enumeration", "EnumType"
|
||||
);
|
||||
}
|
||||
|
||||
// Use reflection to get all fields in the enumeration
|
||||
FieldInfo[] fieldInfos = enumType.GetFields(
|
||||
BindingFlags.Public | BindingFlags.Static
|
||||
);
|
||||
|
||||
// Create an array to hold the enumeration values and copy them over from
|
||||
// the fields we just retrieved
|
||||
TEnum[] values = new TEnum[fieldInfos.Length];
|
||||
for(int index = 0; index < fieldInfos.Length; ++index) {
|
||||
values[index] = (TEnum)fieldInfos[index].GetValue(null);
|
||||
}
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue