I'm looking for a point in the right direction.
I'm in need of a List/Array/?? of a fixed size that I can add to the front, move all elements by one index and push the last element out.
Is it best to just code this behavior and if so are there any best practices to follow? or is there a something that can do this in .net core already?
I'm lacking the correct terminology for this kind of list so googling is difficult any help is appreciated.
Update Just to clarify, I will be listening to a websocket
- Data comes in
- Convert to object
- Add to list/array/stack/??
I envisage the class looking like
List<foo> Stack
AddToStack(Foo)
{
Stack.Add(Foo)
}
Get20SMA()
{
//Gets Last20 objects, does calculation on one property of each object and returns result
}
Get100SMA();
{
//Gets Last100 objects, does calculation on one property of each object and returns result
}