- ago
Hi, 2 globals questions:
1) Can one set a class with multiple members with SetGlobal?
2) Does HasGlobal reset when consumed?
In general can HasGlobal be used more than once?
Thanks!
0
145
2 Replies

Reply

Bookmark

Sort
Cone8
 ( 6.32% )
- ago
#1
1. The strategy itself is a class and you use SetGlobal as many times as you want.
2. No. It's global variable. If variables were "reset" (deleted?) because you made a reference to them, they wouldn't be very useful.
In general, of course.
0
- ago
#2
QUOTE:
2) Does HasGlobal reset when consumed?
In general can HasGlobal be used more than once?

The SetGlobal function simply allocates storage. It has no intrinsic data management function. If you want a FIFO queue function, .NET has collection types to do that.

If you're asking if you can associate a FIFO queue datatype to a SetGlobal memory allocation, I'm "guessing" you could. But let's say you allocate 100 queue elements when you declare your FIFO queue, then you run over 100 elements. Now what happens? I'm not sure the FIFO queue would throw an error. You better check the documentation. https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.queue-1?view=net-8.0

QUOTE:
In general can HasGlobal be used more than once?

If you're employing a FIFO queue, it has a Peek method you can use as many times as you want. But once you dequeue the outgoing element, it's permanently gone. Perhaps you're looking for a different collection type?
0

Reply

Bookmark

Sort