C# Stack IsSynchronized
Description
Stack IsSynchronized
gets a value indicating whether
access to the Stack is synchronized (thread safe).
Syntax
Stack.IsSynchronized
has the following syntax.
public virtual bool IsSynchronized { get; }
Example
The following example shows how to synchronize a Stack, determine if a Stack is synchronized, and use a synchronized Stack.
using System;/*from ww w . j av a2 s.c om*/
using System.Collections;
public class SamplesStack {
public static void Main() {
Stack myStack = new Stack();
myStack.Push( "1" );
Stack mySyncdStack = Stack.Synchronized( myStack );
Console.WriteLine(myStack.IsSynchronized);
Console.WriteLine(mySyncdStack.IsSynchronized);
}
}
The code above generates the following result.