Created
March 10, 2016 06:26
-
-
Save gkinsman/05de7dffd2c803664254 to your computer and use it in GitHub Desktop.
EnumerableOfStringParser
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class EnumerableOfStringParser : IValueParser | |
{ | |
private readonly string _separator; | |
public EnumerableOfStringParser(string separator = null) | |
{ | |
_separator = separator; | |
} | |
public bool CanParse(Type settingValueType) | |
{ | |
return settingValueType == typeof (IEnumerable<string>); | |
} | |
public object Parse(Type settingValueType, string settingValueString) | |
{ | |
return settingValueString.Split(new[] {_separator ?? ","}, StringSplitOptions.RemoveEmptyEntries); | |
} | |
public int SortOrder | |
{ | |
get { return int.MaxValue - 5; } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment