On Thursday, 8 August 2013 at 21:46:02 UTC, Borislav Kosharov wrote:
If I have any enum in a class is it one for all instances or one per instance? Also are enums one per thread or only one?

Every field in a class is per-instance, unless it's marked with 'static', which makes it for all instances but thread-local, or marked with '__gshared', which again makes it for all instances but global (shared among all threads).

I'm assuming you mean code like this:

enum E { a, b, c }

class C
{
    E e1;  // per-instance
    static E e2;  // per-thread
    __gshared E e3;  // shared among all threads
}

Reply via email to