Is it possible to coalesce string and DBNull in C#?

前端 未结 10 1353
滥情空心
滥情空心 2021-01-02 06:24

I\'m writing a C# routine to call a stored proc. In the parameter list I\'m passing in, it is possible that one of the values can legally be null. So I thought I\'d use a

10条回答
  •  遥遥无期
    2021-01-02 06:42

    The ?? operator returns the left-hand operand if it is not null, or else it returns the right operand. But in your case they are different types, so it doesn't work.

提交回复
热议问题