M
Markus Freitag
Guest
Hello,
I have a class stacker, this one has 2 lists in it.
The user interface fills in the lists, empties them from the process and reduces them by the entries.
It may happen that the operator fills these, the process reduces this list by one entry.
How do I get the process-proof realized?
Thanks for your tips and examples in advance.
With best regards Markus
More details for understanding.
Step 1 fills TopList
TopList
3, 200
2, 300
1, 500
Is current list empty I move the top list to current list, the last input, is then the first output.
CurrentList (working list)
3, 200
2, 300
1, 500
CurrentList (working list descrease with 50)
3, 150
2, 300
1, 500
CurrentList (working list descrease with 50)
3, 100
2, 300
1, 500
CurrentList (working list descrease with 50)
3, 50
2, 300
1, 500
CurrentList (working list descrease with 50) if <=0 delete the item.
2, 300
1, 500
Is the current list is empty, the top list has entries move top to current list again.
Maybe BlockingCollection<T> ?
public class Stacker
{
public List<PropertyMaterial> ListTop;
public List<PropertyMaterial> ListCurrent;
public Destacker()
{
ListTop = new List<PropertyMaterial>();
ListCurrent = new List<PropertyMaterial>();
}
public class PropertyMaterial
{
public string TypeNo { get; set; }
public int Quantity { get; set; }
//....
//....
//MainWorkflow.cs
if (CurrentStacker.ListCurrent.Count > 0)
{
CurrentDestacker.ListCurrent[0].Quantity = CurrentDestacker.ListCurrent[0].Quantity - 50;
if (CurrentDestacker.ListCurrent[0].Quantity <= 0)
CurrentDestacker.ListCurrent.RemoveAt(0);
}
BlockingCollection<T>
ConcurrentDictionary<TKey,TValue>
ConcurrentQueue<T> Thread First In, First Out (FIFO)
ConcurrentStack<T> Thread Last In, First Out (LIFO)
ConcurrentBag<T>
Picture
What is right here?
Do I need a thread there?
Continue reading...
I have a class stacker, this one has 2 lists in it.
The user interface fills in the lists, empties them from the process and reduces them by the entries.
It may happen that the operator fills these, the process reduces this list by one entry.
How do I get the process-proof realized?
Thanks for your tips and examples in advance.
With best regards Markus
More details for understanding.
Step 1 fills TopList
TopList
3, 200
2, 300
1, 500
Is current list empty I move the top list to current list, the last input, is then the first output.
CurrentList (working list)
3, 200
2, 300
1, 500
CurrentList (working list descrease with 50)
3, 150
2, 300
1, 500
CurrentList (working list descrease with 50)
3, 100
2, 300
1, 500
CurrentList (working list descrease with 50)
3, 50
2, 300
1, 500
CurrentList (working list descrease with 50) if <=0 delete the item.
2, 300
1, 500
Is the current list is empty, the top list has entries move top to current list again.
Maybe BlockingCollection<T> ?
public class Stacker
{
public List<PropertyMaterial> ListTop;
public List<PropertyMaterial> ListCurrent;
public Destacker()
{
ListTop = new List<PropertyMaterial>();
ListCurrent = new List<PropertyMaterial>();
}
public class PropertyMaterial
{
public string TypeNo { get; set; }
public int Quantity { get; set; }
//....
//....
//MainWorkflow.cs
if (CurrentStacker.ListCurrent.Count > 0)
{
CurrentDestacker.ListCurrent[0].Quantity = CurrentDestacker.ListCurrent[0].Quantity - 50;
if (CurrentDestacker.ListCurrent[0].Quantity <= 0)
CurrentDestacker.ListCurrent.RemoveAt(0);
}
BlockingCollection<T>
ConcurrentDictionary<TKey,TValue>
ConcurrentQueue<T> Thread First In, First Out (FIFO)
ConcurrentStack<T> Thread Last In, First Out (LIFO)
ConcurrentBag<T>
Picture
What is right here?
Do I need a thread there?
Continue reading...