public virtual void setOwnProperty(String name, Object _value) { if (mProperties == null) { mProperties = new Dictionary<String, Object>(); } if (mProperties.ContainsKey(name)) { mProperties.Remove(name); } mProperties[name] = _value; }
public static Object createLiteralObject(params Object[] values) { if (values.Length % 2 != 0) { throw new ArgumentException("Literal object arguments' length should be even: " + values); } AsObject obj = new AsObject(); for (int i = 0; i < values.Length; i += 2) { String key = (String) values[i]; Object value = values[i + 1]; obj.setOwnProperty(key, value); } return obj; }