相关疑难解决方法(0)

如何检查许多参数是否为 null 或空字符串?- C#

我有下面的方法,我需要检查参数是否为空或为空。

    public DB Where(string field, string operat, string value, string andOr, string field2, string operat2, string value2)
    {
        _Where = " WHERE " + field + " " + operat + " @" + field + "1 " + andOr + " " + field2 + " " + operat2 + " @" + field2 + "2 ";
        _Params.Add(field + "1", value);
        _Params.Add(field2 + "2", value2);
        return this;
    }
Run Code Online (Sandbox Code Playgroud)

我找到了 string.IsNullOrWhiteSpace 方法,但这需要这么多代码:

                   if (string.IsNullOrWhiteSpace(field))
            throw new ArgumentException("field Cannot be null …
Run Code Online (Sandbox Code Playgroud)

c# string null isnullorempty

3
推荐指数
1
解决办法
6439
查看次数

标签 统计

c# ×1

isnullorempty ×1

null ×1

string ×1