KKSK@🌸🎵🌸🎵🌸
❔ cast parent to child
The class was originally in the Net 6 project where the methods include some libraries that may not be compatible in the net framework class.
I am currently implementing a shared library that uses an interface based grpc to communicate in between.
So I am trying to move the class to the shared project.
27 replies
❔ cast parent to child
I just kind of understand your comment.
What you mean is if object was child and was cast to parent, this can be cast to child again?
But my case was the original is of a parent, and I am passing this parent object to this method.
Within the method I am casting it to child.
So it seems like impossible?
27 replies
❔ Write an Aggregate
Yes, you could use the Aggregate method to achieve the same result as the code you posted. The Aggregate method allows you to perform a calculation on a sequence and return a single result. In this case, you could use it to track the visited houses and return the total number of houses visited.
Here's an example of how you could use Aggregate to accomplish this:
As you can see, the Aggregate method allows us to perform the same operations as the code you posted, but with a more concise and functional-style syntax. I hope this helps! Let me know if you have any other questions.
7 replies