Threading Questions

Kagamin via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Oct 8 03:11:36 PDT 2015


On Thursday, 8 October 2015 at 02:31:24 UTC, bitwise wrote:
> If you have System.Collections.Generic.List(T) static class 
> member, there is nothing wrong with using it from multiple 
> threads like this:

The equivalent of your D example would be

class Foo {
     static List<int> numbers = new List<int>();
     void bar() {
         new Thread(()=>{
             numbers.Add(1);
         }).Start();
     }
}


More information about the Digitalmars-d-learn mailing list