如果字符串在c#中有空或空格,如何返回false

nit*_*raj 2 c# asp.net

我不能返回null因为我Hlist是一个不可为空的类型.还有什么我可以在null的地方返回?

HList findHListentry(string letter)
{
    if (string.IsNullOrWhiteSpace(letter))
    {
        HList result = listentry.Find(delegate(HList bk)
                       {
                           return bk.letter == letter;
                       });
        return result;
    }
    else
    {
        return ?;
    }
}
Run Code Online (Sandbox Code Playgroud)

spe*_*der 5

用一个Nullable<HList>代替?

HList? findHListentry(string letter)
{
    ///
    return null;
}
Run Code Online (Sandbox Code Playgroud)