InArgCount Property
Collapse the table of content
Expand the table of content

IMethodCallMessage.InArgCount Property

Gets the number of arguments in the call that are not marked as out parameters.

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

int InArgCount { get; }

Property Value

Type: System.Int32
The number of arguments in the call that are not marked as out parameters.


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

The following example code shows a custom proxy that overrides RealProxy.Invoke in order to write the call message information to the console.

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

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

         IMethodCallMessage myIMethodCallMessage;
         Console.WriteLine("InArgCount is  : " + 

         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 : " + 
            Console.WriteLine("GetInArg("+i.ToString() +") is : " +
      else if (myIMessage is IMethodReturnMessage)
         Console.WriteLine("Message is of type 'IMethodReturnMessage'.");

      // Build Return Message
      myReturnMessage = new ReturnMessage(5,null,0,null,

      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, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Community Additions

© 2016 Microsoft