Skip to content

Instantly share code, notes, and snippets.

@alexanderfast
Created December 3, 2012 13:18
Show Gist options
  • Save alexanderfast/4194998 to your computer and use it in GitHub Desktop.
Save alexanderfast/4194998 to your computer and use it in GitHub Desktop.
ResourcedOptionAttribute
internal class ResourcedOptionAttribute : OptionAttribute
{
private string helpTextKey;
public ResourcedOptionAttribute(string shortName, string longName)
: base(shortName, longName)
{
}
public string HelpTextKey
{
get { return helpTextKey; }
set
{
helpTextKey = value;
base.HelpText = Resources.ResourceManager.GetString(value);
}
}
public new string HelpText
{
get { return base.HelpText; }
set
{
throw new InvalidOperationException(
"ResourcedOption: Specify HelpTextKey instead.");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment