예제 #1
0
        /// <summary>
        /// Gets the ith element of collection at named property
        /// </summary>
        /// <param name='type'>
        /// Type.
        /// </param>
        /// <param name='name'>
        /// Name.
        /// </param>
        /// <param name='ith'>
        /// Index.
        /// </param>
        public object GetIndexedProperty(object obj, string name, int ith)
        {
            // send request
            var req = new CLRGetIndexedPropertyMessage(obj, name, ith);

            CLRMessage.Write(_cout, req);

            // get response
            return(CLRMessage.ReadValue(_cin));
        }
예제 #2
0
 /// <summary>
 /// Gets the indexed property.
 /// </summary>
 /// <param name="req">Req.</param>
 private void HandleGetIndexedProperty(CLRGetIndexedPropertyMessage req)
 {
     try
     {
         // get object
         var obj = ToLocalObject(req.Obj);
         // invoke
         var result = _api.GetIndexedProperty(obj, req.PropertyName, req.Index);
         CLRMessage.WriteValue(_cout, result);
     }
     catch (TargetInvocationException te)
     {
         CLRMessage.WriteValue(_cout, te.GetBaseException());
     }
     catch (Exception e)
     {
         CLRMessage.WriteValue(_cout, e);
     }
 }