Skip to content

Instantly share code, notes, and snippets.

@IntegerMan
Created September 12, 2019 03:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IntegerMan/22a491b508c861765c5f46064bf145b7 to your computer and use it in GitHub Desktop.
Save IntegerMan/22a491b508c861765c5f46064bf145b7 to your computer and use it in GitHub Desktop.
public Option<ResumeKeyword> GetKeyword(
IDictionary<string, ResumeKeyword> keywords,
string word) {
// Ensure we're searching for a lower-cased non-null word
string key = word ?? word.ToLowerInvariant() : string.Empty;
// If the keyword is present, return it
if (keywords.ContainsKey(key)) {
return keywords[key]; // Implicitly converted to Some<ResumeKeyword>
}
// No keyword found
return Option<ResumeKeyword>.None;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment