paparazzo
paparazzo

Reputation: 45096

How to define byte? null parameter

How to create null byte?

This is what I do

byte? nb = null;

methodCall (rdr.IsDBNull(15) ? nb : rdr.GetByte(15));

This does not even complile.
What is the proper syntax?

methodCall (rdr.IsDBNull(15) ? (null)byte : rdr.GetByte(15));

Upvotes: 0

Views: 89

Answers (1)

Marc Gravell
Marc Gravell

Reputation: 1062895

Try:

(byte?)null : rdr.GetByte(...)

Upvotes: 2

Related Questions