-
-
Save Implem/253dac8f855589e756dc to your computer and use it in GitHub Desktop.
c# 指定した順番に引数をチェックして最初に空以外の文字列を返却する関数 ref: http://qiita.com/Implem/items/3597467db38059e7011c
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
var a = GetCascade("", null, "abc", "def"); |
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 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