If i iterate over a list of Weakreference
s, how can i be sure, the reference still exists, after proofing via _ref.IsAlive
?
For example i have this piece of code, where scopeReferences
is a of Weakreference
s:
foreach (var _ref in scopeReferences)
{
if (_ref.IsAlive)
{
if (_ref.Target is ScriptScope)
{
// Is it alive any more?
((ScriptScope)_ref.Target).SetVariable(name, value);
}
}
}
Maybe some one knows the answer, i just don't want to create any problems due to the fact, i don't know what's going on in this part. Thank you all a lot!