コード例 #1
0
ファイル: Array.cs プロジェクト: NinZine/playscript-mono
 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);
     }
 }
コード例 #2
0
ファイル: Array.cs プロジェクト: NinZine/playscript-mono
 void PlayScript.IDynamicClass.__SetDynamicValue(string name, object value)
 {
     if (__dynamicProps == null)
     {
         __dynamicProps = new PlayScript.DynamicProperties(this);
     }
     __dynamicProps.__SetDynamicValue(name, value);
 }
コード例 #3
0
ファイル: Array.cs プロジェクト: NinZine/playscript-mono
 // this method can be used to override the dynamic property implementation of this dynamic class
 void __SetDynamicProperties(PlayScript.IDynamicClass props)
 {
     __dynamicProps = props;
 }