Skip to content

Instantly share code, notes, and snippets.

@Implem
Created May 19, 2015 22:21
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 Implem/253dac8f855589e756dc to your computer and use it in GitHub Desktop.
Save Implem/253dac8f855589e756dc to your computer and use it in GitHub Desktop.
c# 指定した順番に引数をチェックして最初に空以外の文字列を返却する関数 ref: http://qiita.com/Implem/items/3597467db38059e7011c
var a = GetCascade("", null, "abc", "def");
public static string GetCascade(params string[] args)
{
return args
.Where(o => !o.IsNullOrEmpty())
.FirstOrDefault() ?? string.Empty;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment