IMethodReturnMessage 인터페이스

정의

메서드 호출 반환 메시지 인터페이스를 정의합니다.

public interface class IMethodReturnMessage : System::Runtime::Remoting::Messaging::IMethodMessage
public interface IMethodReturnMessage : System.Runtime.Remoting.Messaging.IMethodMessage
[System.Runtime.InteropServices.ComVisible(true)]
public interface IMethodReturnMessage : System.Runtime.Remoting.Messaging.IMethodMessage
type IMethodReturnMessage = interface
    interface IMethodMessage
    interface IMessage
[<System.Runtime.InteropServices.ComVisible(true)>]
type IMethodReturnMessage = interface
    interface IMethodMessage
    interface IMessage
Public Interface IMethodReturnMessage
Implements IMethodMessage
파생
특성
구현

예제

다음 예제 코드에서는 사용자 지정 프록시를 해당 재정의 RealProxy.Invoke 반환 메시지 정보를 콘솔에 쓰려면 합니다.

[System::Security::Permissions::SecurityPermissionAttribute
(System::Security::Permissions::SecurityAction::LinkDemand, 
Flags=System::Security::Permissions::SecurityPermissionFlag::Infrastructure)]
[System::Security::Permissions::SecurityPermissionAttribute
(System::Security::Permissions::SecurityAction::InheritanceDemand, 
Flags=System::Security::Permissions::SecurityPermissionFlag::Infrastructure)]
public ref class MyProxy: public RealProxy
{
private:
   String^ stringUri;
   MarshalByRefObject^ myMarshalByRefObject;

public:
   MyProxy( Type^ myType ) : RealProxy( myType )
   {
      myMarshalByRefObject = dynamic_cast<MarshalByRefObject^>(Activator::CreateInstance( myType ));
      ObjRef^ myObject = RemotingServices::Marshal( myMarshalByRefObject );
      stringUri = myObject->URI;
   }

   virtual IMessage^ Invoke( IMessage^ myMessage ) override
   {
      IMethodCallMessage^ myCallMessage = (IMethodCallMessage^)( myMessage );

      IMethodReturnMessage^ myIMethodReturnMessage =
         RemotingServices::ExecuteMessage( myMarshalByRefObject, myCallMessage );

      Console::WriteLine( "Method name : {0}", myIMethodReturnMessage->MethodName );
      Console::WriteLine( "The return value is : {0}", myIMethodReturnMessage->ReturnValue );

      // Get number of 'ref' and 'out' parameters.
      int myArgOutCount = myIMethodReturnMessage->OutArgCount;
      Console::WriteLine( "The number of 'ref', 'out' parameters are : {0}",
         myIMethodReturnMessage->OutArgCount );
      // Gets name and values of 'ref' and 'out' parameters.
      for ( int i = 0; i < myArgOutCount; i++ )
      {
         Console::WriteLine( "Name of argument {0} is '{1}'.",
            i, myIMethodReturnMessage->GetOutArgName( i ) );
         Console::WriteLine( "Value of argument {0} is '{1}'.",
            i, myIMethodReturnMessage->GetOutArg( i ) );
      }
      Console::WriteLine();
      array<Object^>^myObjectArray = myIMethodReturnMessage->OutArgs;
      for ( int i = 0; i < myObjectArray->Length; i++ )
         Console::WriteLine( "Value of argument {0} is '{1}' in OutArgs",
            i, myObjectArray[ i ] );
      return myIMethodReturnMessage;
   }
};
public class MyProxy : RealProxy
{
   String stringUri;
   MarshalByRefObject myMarshalByRefObject;

   public MyProxy(Type myType): base(myType)
   {
      myMarshalByRefObject = (MarshalByRefObject)Activator.CreateInstance(myType);
      ObjRef myObject = RemotingServices.Marshal(myMarshalByRefObject);
      stringUri = myObject.URI;
   }

   public override IMessage Invoke(IMessage myMessage)
   {
      IMethodCallMessage myCallMessage = (IMethodCallMessage)myMessage;

      IMethodReturnMessage myIMethodReturnMessage =
         RemotingServices.ExecuteMessage(myMarshalByRefObject, myCallMessage);

      Console.WriteLine("Method name : " + myIMethodReturnMessage.MethodName);
      Console.WriteLine("The return value is : " + myIMethodReturnMessage.ReturnValue);

      // Get number of 'ref' and 'out' parameters.
      int myArgOutCount = myIMethodReturnMessage.OutArgCount;
      Console.WriteLine("The number of 'ref', 'out' parameters are : " +
         myIMethodReturnMessage.OutArgCount);
      // Gets name and values of 'ref' and 'out' parameters.
      for(int i = 0; i < myArgOutCount; i++)
      {
         Console.WriteLine("Name of argument {0} is '{1}'.",
            i, myIMethodReturnMessage.GetOutArgName(i));
         Console.WriteLine("Value of argument {0} is '{1}'.",
            i, myIMethodReturnMessage.GetOutArg(i));
      }
      Console.WriteLine();
      object[] myObjectArray = myIMethodReturnMessage.OutArgs;
      for(int i = 0; i < myObjectArray.Length; i++)
         Console.WriteLine("Value of argument {0} is '{1}' in OutArgs",
            i, myObjectArray[i]);
      return myIMethodReturnMessage;
   }
}
<PermissionSet(SecurityAction.Demand, Name:="FullTrust")> _
Public Class MyProxy
   Inherits RealProxy
   Private stringUri As String
   Private myMarshalByRefObject As MarshalByRefObject
   
   Public Sub New(myType As Type)
      MyBase.New(myType)
      myMarshalByRefObject = CType(Activator.CreateInstance(myType), MarshalByRefObject)
      Dim myObject As ObjRef = RemotingServices.Marshal(myMarshalByRefObject)
      stringUri = myObject.URI
   End Sub
   
   Public Overrides Function Invoke(myMessage As IMessage) As IMessage
      Dim myCallMessage As IMethodCallMessage = CType(myMessage, IMethodCallMessage)

      Dim myIMethodReturnMessage As IMethodReturnMessage = RemotingServices. _
         ExecuteMessage(myMarshalByRefObject, myCallMessage)

      Console.WriteLine("Method name : " + myIMethodReturnMessage.MethodName)
      Console.WriteLine("The return value is : " + myIMethodReturnMessage.ReturnValue)
      
      ' Get number of 'ref' and 'out' parameters.
      Dim myArgOutCount As Integer = myIMethodReturnMessage.OutArgCount
      Console.WriteLine("The number of 'ref', 'out' parameters are : " + _
         myIMethodReturnMessage.OutArgCount.ToString())
      ' Gets name and values of 'ref' and 'out' parameters.
      Dim i As Integer
      For i = 0 To myArgOutCount - 1
         Console.WriteLine("Name of argument {0} is '{1}'.", i, _
            myIMethodReturnMessage.GetOutArgName(i))
         Console.WriteLine("Value of argument {0} is '{1}'.", i, _
            myIMethodReturnMessage.GetOutArg(i))
      Next i
      Console.WriteLine()
      Dim myObjectArray As Object() = myIMethodReturnMessage.OutArgs
      For i = 0 To myObjectArray.Length - 1
         Console.WriteLine("Value of argument {0} is '{1}' in OutArgs", i, myObjectArray(i))
      Next i
      Return myIMethodReturnMessage
   End Function 'Invoke
End Class

설명

메서드 호출 반환 메시지를 메시지 싱크 끝날 때 개체에서 메서드 호출에 대 한 응답을 나타냅니다. IMethodReturnMessage 원격 개체에 대해 호출 하는 메서드의 결과로 생성 되 고 호출자에 메서드 호출의 결과 반환 하는 데 사용 됩니다.

속성

ArgCount

‘메서드에 전달된 인수의 개수를 가져옵니다.

(다음에서 상속됨 IMethodMessage)
Args

메서드에 전달된 인수의 배열을 가져옵니다.

(다음에서 상속됨 IMethodMessage)
Exception

메서드를 호출하는 동안 throw된 예외를 가져옵니다.

HasVarArgs

메시지에 가변 인수가 있는지 나타내는 값을 가져옵니다.

(다음에서 상속됨 IMethodMessage)
LogicalCallContext

현재 메서드 호출에 대한 LogicalCallContext를 가져옵니다.

(다음에서 상속됨 IMethodMessage)
MethodBase

호출된 메서드의 MethodBase를 가져옵니다.

(다음에서 상속됨 IMethodMessage)
MethodName

호출된 메서드의 이름을 가져옵니다.

(다음에서 상속됨 IMethodMessage)
MethodSignature

메서드 시그니처가 들어 있는 개체를 가져옵니다.

(다음에서 상속됨 IMethodMessage)
OutArgCount

refout 매개 변수로 표시되는 메서드 호출의 인수 개수를 가져옵니다.

OutArgs

refout 매개 변수로 표시되는 지정된 인수를 반환합니다.

Properties

메시지의 속성 컬렉션을 나타내는 IDictionary를 가져옵니다.

(다음에서 상속됨 IMessage)
ReturnValue

메서드 호출의 반환 값을 가져옵니다.

TypeName

호출이 향하는 특정 개체의 전체 Type 이름을 가져옵니다.

(다음에서 상속됨 IMethodMessage)
Uri

호출이 향하는 특정 개체의 URI를 가져옵니다.

(다음에서 상속됨 IMethodMessage)

메서드

GetArg(Int32)

특정 인수를 Object로 가져옵니다.

(다음에서 상속됨 IMethodMessage)
GetArgName(Int32)

메서드에 전달된 인수의 이름을 가져옵니다.

(다음에서 상속됨 IMethodMessage)
GetOutArg(Int32)

refout 매개 변수로 표시되는 지정된 인수를 반환합니다.

GetOutArgName(Int32)

refout 매개 변수로 표시되는 지정된 인수의 이름을 반환합니다.

적용 대상