示例#1
0
        /// <summary>
        /// Gets the ith element of collection
        /// </summary>
        /// <param name='type'>
        /// Type.
        /// </param>
        /// <param name='ith'>
        /// Index.
        /// </param>
        public object GetIndexed(object obj, int ith)
        {
            // send request
            var req = new CLRGetIndexedMessage(obj, ith);

            CLRMessage.Write(_cout, req);

            // get response
            return(CLRMessage.ReadValue(_cin));
        }
示例#2
0
 /// <summary>
 /// Gets the indexed value on an object
 /// </summary>
 /// <param name="req">Req.</param>
 private void HandleGetIndexed(CLRGetIndexedMessage req)
 {
     try
     {
         // get object
         var obj = ToLocalObject(req.Obj);
         // invoke
         var result = _api.GetIndexed(obj, req.Index);
         CLRMessage.WriteValue(_cout, result);
     }
     catch (TargetInvocationException te)
     {
         CLRMessage.WriteValue(_cout, te.GetBaseException());
     }
     catch (Exception e)
     {
         CLRMessage.WriteValue(_cout, e);
     }
 }