Nullのときは値をいれてNullでないときはそのまま返す拡張メソッド

なんとなく思いついたというか欲しかった。ナイの?
「IsNullOrEmptyはゆとり」と同レベル

static public T IfNullUnderstudy<T>( this T source, T understudy ) where T : class {
	return source == null ? understudy : source;
}

Nullオブジェクトは大仕掛けだよねって時に


こんなのやったら発狂するひとでも出るかも

static public string IfNullOrEmptyThenUnderstudy( this string source, string understudy ) {
	return string.IsNullOrEmpty( source ) ? understudy : source;
}