1
I have it:
model.Items = new List<CatalogItemResponse>() { qryMode };
gives error because qryMode is of type Catalogitemresponse and not a list of the Catalogitemresponse
How to inputo qryMode into model?
1
I have it:
model.Items = new List<CatalogItemResponse>() { qryMode };
gives error because qryMode is of type Catalogitemresponse and not a list of the Catalogitemresponse
How to inputo qryMode into model?
0
If model.Items
be the type List<CatalogItemResponse>
, try this:
model.Items = new List<CatalogItemResponse>();
model.Items.Add(qryMode);
Browser other questions tagged c#
You are not signed in. Login or sign up in order to post.
I realized that the "downvotes" are ALMOST ALWAYS for Microsoft product posts (VB, C#, etc...) ... weird, right?
– FabioIn
I gave an Addrange(qryMode) and I’ll test
– pnet
Apparently your code is correct, I even made a test code on dotnetFiddle and it worked correctly: https://dotnetfiddle.net/8dX2IX
– Julio Borges
I’ve seen cases of questions with +30 up on Soen, here the question looked like -3. About the question, model.Items is already instantiated? If yes, just give an add(qryMode).
– Marceloawq
It did not function, but I saw some strange things. I will debug and post, but as I assign the object in a list?
– pnet
There’s nothing wrong with your code. I validated it locally with test code and it works perfectly. There’s something else there!
– João Martins
I think that’s missing:
model.Items = new List<CatalogItemResponse>()
and thenmodel.Items.AddRange(qryMode)
– pnet
I will remove the comments of vent, as they are outside the scope of the site, but I was really upset. And then remove this too
– pnet
What was missing in the question was specifying which qryMode was a list. That’s why Addrange worked. Without this information it would be difficult for anyone to help.
– George Wurthmann