Example #1
0
 public dynamic this[string name]
 {
     get {
         int index;
         if (int.TryParse(name, out index))
         {
             // If we can convert the string to an index, then it is an indexed access
             return(mList[index]);
         }
         // Otherwise this is a dynamic property. However we can't use mList[name] as we would lose the undefined information,
         // it would be replaced bny default(T), so in this case null.
         if (__dynamicProps != null)
         {
             return(__dynamicProps.__GetDynamicValue(name));
         }
         return(PlayScript.Undefined._undefined);
     }
     set {
         int index;
         if (int.TryParse(name, out index))
         {
             // If we can convert the string to an index, then it is an indexed access
             mList[index] = value;
             return;
         }
         if (__dynamicProps == null)
         {
             __dynamicProps = new PlayScript.DynamicProperties(this);
         }
         __dynamicProps.__SetDynamicValue(name, value);
     }
 }
Example #2
0
 void PlayScript.IDynamicClass.__SetDynamicValue(string name, object value)
 {
     if (__dynamicProps == null)
     {
         __dynamicProps = new PlayScript.DynamicProperties(this);
     }
     __dynamicProps.__SetDynamicValue(name, value);
 }
Example #3
0
 // this method can be used to override the dynamic property implementation of this dynamic class
 void __SetDynamicProperties(PlayScript.IDynamicClass props)
 {
     __dynamicProps = props;
 }