Sorry for the very rudimentary question.
I used LINQ to join the two tables.
using(var db = new BooksDbContext())
{
var q = db.Books.Join(db.Author,
b => b.Id,
a => a.Id,
(b, a) => new { Book = b, Author = a });
}
From the obtained result, I would like to fill the null part with 0. I want to leave non-null values as they are.
If you write it without using LINQ, you can imagine this. 0 if null. If it is not null, the value is stored as it is.
while (reader.Read())
{
for(var i = 0; i <= 10; i++)
{
if (Convert.IsDBNull(reader[i]))
{
testList[i] = 0;
}
else testList[i] = reader[i]
}
}
I want to do this with LINQ, but I'm having a hard time thinking about it. I would like advice. Sorry for the boring question.