Ejemplo n.º 1
0
        /// <summary>
        /// Dynamically resolves get access to properties and fields.
        /// Cannot be used asynchorously.
        /// If you need asynchronous access, please cast the object to an AppVar
        /// and use a FriendlyOperation, or call it in the form of a method by specifying a
        /// method name equal to the property name.
        /// </summary>
        /// <param name="binder">Binder.</param>
        /// <param name="result">Retrieved result.</param>
        /// <returns>Success or failure.</returns>
#else
        /// <summary>
        /// プロパティーへのアクセス(getter)の動的解決です。
        /// 非同期実行はできません。
        /// どうしても非同期実行が必要な場合はAppVarにキャストして、FriendlyOperationを使用するか、
        /// メソッド形式の呼び出しを実行してください。
        /// メソッド名称はプロパティー名称と同一です。
        /// </summary>
        /// <param name="binder">バインダー。</param>
        /// <param name="result">取得結果。</param>
        /// <returns>成否。</returns>
#endif
        public override bool TryGetMember(GetMemberBinder binder, out object result)
        {
            string nextName = JointName(_name, binder.Name);

            if (!_isType ||                          //現在の名前が型でないのなら、つなげる
                IsTypeName(_app, nextName, _isType)) //現在の名前が型でも、つなげた名前が型になるなら、つなげる。
            {
                dynamic next = new DynamicAppType(_app, nextName);
                result = next;
            }
            else
            {
                //staticなgetter呼び出し。
                result = _app[nextName]().Dynamic();
            }
            return(true);
        }
Ejemplo n.º 2
0
        public override bool TryGetMember(GetMemberBinder binder, out object result)
        {
            string nextName = JointName(_name, binder.Name);

            if (!_isType || //現在の名前が型でないのなら、つなげる
                IsTypeName(_app, nextName, _isType)) //現在の名前が型でも、つなげた名前が型になるなら、つなげる。
            {
                dynamic next = new DynamicAppType(_app, nextName);
                result = next;
            }
            else
            {
                //staticなgetter呼び出し。
                result = _app[nextName]().Dynamic();
            }
            return true;
        }