❔ Can't get around on how to instantiate this.
I can't get around on how to instantiate this in my service.cs so i can call it properly in my controller.
Relevant code below.
https://paste.mod.gg/kocfivzcagoc/0
BlazeBin - kocfivzcagoc
A tool for sharing your source code with the world!
28 Replies
Word frequency result is not word frequency
Yes i know they are two different types but I'd like to be able to generate Word frequency result
https://paste.mod.gg/kocfivzcagoc/0
BlazeBin - kocfivzcagoc
A tool for sharing your source code with the world!
New one up
My Challenge is making below to return - Word frequency result @phaseshift
I've tried instantiate Lists
You don't even have new wordfreqresult
Shouldn't something like this work?
Doubt it. Isn't 'result' meant to contain the lists?
I do have a
Result is meant to return the values i wish to give as output in my endpoint through Response.cs
Yeah, so that should be the last thing you new.
Putting it inside linq select is going to make a collection of 'result'
var lists = linq stuff
Var result = new Result(lists)
Here is a another example but if works fine difference are the type in Result.cs
https://paste.mod.gg/tpnvxlicymuu/0
BlazeBin - tpnvxlicymuu
A tool for sharing your source code with the world!
Exactly i need to return a List<WordFrequency> with linq.
But when i do .Select(x => new (starting my instansiations) ) // i get wrong.
What type does your linq statement return?
List<WordFrequency> right now.
Right. And what does result take?
Not that.
So you need to figure out how to nest another list
If we break down the question.
It would be, how do would you instantiate
WordFrequencyResult takes
And WordFrequency is
What. You want list of list of result?
That's four nested lists.
Yes otherwise i'll break architectual pattern that i've done. like the Authentication link i sent before
Well it's dumb. But it's not complicated
Frequencies is only one list
So you need another list before you make a result
Yes.
Im having incompetent problems on getting that list.
You make the list before the loop where you make frequencies
Then inside that loop, you added frequencies to it
Your problem is literally the same as how to add numbers to a list
Just replace'numbers' with 'some other list'
4 lists yes you're right.
So problem is solved? You know how to do it
Nope, This gave me List<List<List<WordFrequencyResult>>>
'this'?
The code above xD
How
You just need to pay more attention
Yes, I managed to solve it now, all thanks to you - it's about thinking and working on single things and not over complicate it.
And you actually helped me realize that my achitecture is dumb. but i think if my application was much much bigger it wouldn't be so dumb
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.