Export (0) Print
Expand All

IMethodCallMessage.InArgs Property

Gets an array of arguments that are not marked as out parameters.

Namespace:  System.Runtime.Remoting.Messaging
Assembly:  mscorlib (in mscorlib.dll)

Object[] InArgs { get; }

Property Value

Type: System.Object[]
An array of arguments that are not marked as out parameters.

ExceptionCondition
SecurityException

The immediate caller makes the call through a reference to the interface and does not have infrastructure permission.

Although the InArgs property is redundant since the same functionality can be achieved with the InArgCount and GetInArg methods, there might be performance optimization available if the implementer understands when all the arguments will be retrieved.


   public override IMessage Invoke(IMessage myIMessage)
   {
      Console.WriteLine("MyProxy.Invoke Start");
      Console.WriteLine("");
      ReturnMessage myReturnMessage = null;

      if (myIMessage is IMethodCallMessage)
      {
         Console.WriteLine("Message is of type 'IMethodCallMessage'.");
         Console.WriteLine("");

         IMethodCallMessage myIMethodCallMessage;
         myIMethodCallMessage=(IMethodCallMessage)myIMessage;
         Console.WriteLine("InArgCount is  : " + 
                           myIMethodCallMessage.InArgCount.ToString());

         foreach (object myObj in myIMethodCallMessage.InArgs)
         {
            Console.WriteLine("InArgs is : " + myObj.ToString());
         }

         for(int i=0; i<myIMethodCallMessage.InArgCount; i++)
         {
            Console.WriteLine("GetArgName(" +i.ToString() +") is : " + 
                                    myIMethodCallMessage.GetArgName(i));
            Console.WriteLine("GetInArg("+i.ToString() +") is : " +
                           myIMethodCallMessage.GetInArg(i).ToString());
         }
         Console.WriteLine("");
      }
      else if (myIMessage is IMethodReturnMessage)
         Console.WriteLine("Message is of type 'IMethodReturnMessage'.");

      // Build Return Message
      myReturnMessage = new ReturnMessage(5,null,0,null,
                                    (IMethodCallMessage)myIMessage);

      Console.WriteLine("MyProxy.Invoke - Finish");
      return myReturnMessage;
   }


}


// The class used to obtain Metadata.
[PermissionSet(SecurityAction.Demand, Name="FullTrust")]
public class MyMarshalByRefClass : MarshalByRefObject
{
   public int MyMethod(string str, double dbl, int i)
   {
      Console.WriteLine("MyMarshalByRefClass.MyMethod {0} {1} {2}", str, dbl, i);
      return 0;
   }
}

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Show:
© 2015 Microsoft