IronRuby.Runtime.RubyInstanceData.GetInstanceVariables C# (CSharp) Method

GetInstanceVariables() private method

Gets the instance variables dictionary, initializing it if it was null. Only use this if you want to set something into the dictionary, otherwise just use the _instanceVars field
private GetInstanceVariables ( ) : object>.Dictionary
return object>.Dictionary
        private Dictionary<string, object>/*!*/ GetInstanceVariables() {
            if (_instanceVars == null) {
                var newValue = new Dictionary<string, object>();
                if (Interlocked.CompareExchange(ref _instanceVars, newValue, null) == null) {
                    return newValue;
                }
            }
            return _instanceVars;
        }

Usage Example

Exemplo n.º 1
0
 internal void CopyInstanceVariablesTo(RubyInstanceData /*!*/ dup)
 {
     if (_instanceVars == null)
     {
         return;
     }
     lock (_instanceVars) {
         Dictionary <string, object> dupVars = dup.GetInstanceVariables();
         foreach (var var in _instanceVars)
         {
             dupVars.Add(var.Key, var.Value);
         }
     }
 }
All Usage Examples Of IronRuby.Runtime.RubyInstanceData::GetInstanceVariables