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

TryGetInstanceVariable() private method

private TryGetInstanceVariable ( string name, object &value ) : bool
name string
value object
return bool
        internal bool TryGetInstanceVariable(string/*!*/ name, out object value) {
            if (_instanceVars == null) {
                value = null;
                return false;
            }
            lock (_instanceVars) {
                return _instanceVars.TryGetValue(name, out value);
            }
        }

Usage Example

示例#1
0
 [Emitted] //RubyTypeBuilder
 public static void SerializeObject(RubyInstanceData instanceData, RubyClass/*!*/ immediateClass, SerializationInfo/*!*/ info) {
     info.AddValue(RubyUtils.SerializationInfoClassKey, immediateClass, typeof(RubyClass));
     if (instanceData != null) {
         string[] instanceNames = instanceData.GetInstanceVariableNames();
         foreach (string name in instanceNames) {
             object value;
             if (!instanceData.TryGetInstanceVariable(name, out value)) {
                 value = null;
             }
             info.AddValue(name, value, typeof(object));
         }
     }
 }