[This is preliminary documentation and is subject to change.]

Returns whether or not the world contains the specified World object.

Namespace: Clarion
Assembly: CLARIONLibrary (in CLARIONLibrary.dll) Version: 6.1.0.7 (6.1.0.7)

Syntax

C#
public static bool Contains(
	IWorldObject o
)

Parameters

o
Type: Clarion.Framework.Core..::..IWorldObject
The World object whose membership within the world you wish to check

Return Value

True if the specified World object is in the world, otherwise false

Remarks

Caution
This method is NOT thread safe!

For example, suppose your code calls this method to determine if a particular World object is present in the world, while at the same time another thread calls one of the "New..." methods to add that World object to the world. In this case, this method MAY return false when the same method call, if it took place a moment later (perhaps even right after your if statement), would return true.

To handle this thread-safety issue, it is advised that you wrap the segments of code which intend to use this method with a thread-lock. For more information on thread locking see:

Examples

Below is an example of how the thread-safety issue could be correctly handled:
CopyC#
ReaderWriterLockSlim _locker = new ReaderWriterLockSlim();
_locker.EnterWriteLock();
DimensionValuePair dv = World.NewDimensionValuePair("Example Dimension","Example Value");
_locker.ExitWriteLock();

...

//at some other point in your code
_locker.EnterReadLock();
if (World.Contains(dv))
{
    ...     //elided for simplicity
}
_locker.ExitReadLock();

See Also