aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Core/ExtensionMethods
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/Tango.Core/ExtensionMethods')
-rw-r--r--Software/Visual_Studio/Tango.Core/ExtensionMethods/StringExtensions.cs12
1 files changed, 12 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Tango.Core/ExtensionMethods/StringExtensions.cs b/Software/Visual_Studio/Tango.Core/ExtensionMethods/StringExtensions.cs
index f03bcb647..7a03b8ae4 100644
--- a/Software/Visual_Studio/Tango.Core/ExtensionMethods/StringExtensions.cs
+++ b/Software/Visual_Studio/Tango.Core/ExtensionMethods/StringExtensions.cs
@@ -233,4 +233,16 @@ public static class StringExtensions
{
return String.IsNullOrEmpty(str) ? null : str;
}
+
+ public static List<T> ToEnumValues<T>(this String str, char splitChar) where T : struct
+ {
+ if (!String.IsNullOrWhiteSpace(str))
+ {
+ return str.Split(splitChar).Select(x => (T)Convert.ChangeType(int.Parse(x),typeof(T))).ToList();
+ }
+ else
+ {
+ return new List<T>();
+ }
+ }
}