Skip to content

Instantly share code, notes, and snippets.

@gkinsman
Created March 10, 2016 06:26
Show Gist options
  • Save gkinsman/05de7dffd2c803664254 to your computer and use it in GitHub Desktop.
Save gkinsman/05de7dffd2c803664254 to your computer and use it in GitHub Desktop.
EnumerableOfStringParser
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