다음을 통해 공유


ReturnMessage 클래스

정의

원격 개체에 대한 메서드 호출에 대한 응답으로 반환된 메시지를 보유합니다.

public ref class ReturnMessage : System::Runtime::Remoting::Messaging::IMethodReturnMessage
public class ReturnMessage : System.Runtime.Remoting.Messaging.IMethodReturnMessage
[System.Runtime.InteropServices.ComVisible(true)]
public class ReturnMessage : System.Runtime.Remoting.Messaging.IMethodReturnMessage
[System.Runtime.InteropServices.ComVisible(true)]
[System.Security.SecurityCritical]
public class ReturnMessage : System.Runtime.Remoting.Messaging.IMethodReturnMessage
type ReturnMessage = class
    interface IMethodReturnMessage
    interface IMethodMessage
    interface IMessage
[<System.Runtime.InteropServices.ComVisible(true)>]
type ReturnMessage = class
    interface IMethodReturnMessage
    interface IMethodMessage
    interface IMessage
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Security.SecurityCritical>]
type ReturnMessage = class
    interface IMethodReturnMessage
    interface IMethodMessage
    interface IMessage
Public Class ReturnMessage
Implements IMethodReturnMessage
상속
ReturnMessage
특성
구현

예제

[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

설명

메모

이 클래스는 클래스 수준에서 링크 요청 및 상속 요청을 만듭니다. 직접 호출자 또는 파생 클래스에 인프라 권한이 없는 경우 A SecurityException 가 throw됩니다. 보안 요구 사항에 대한 자세한 내용은 링크 요구를 참조하세요.

생성자

Name Description
ReturnMessage(Exception, IMethodCallMessage)

ReturnMessage 클래스의 새 인스턴스를 초기화합니다.

ReturnMessage(Object, Object[], Int32, LogicalCallContext, IMethodCallMessage)

메서드 호출 후 호출자에게 반환되는 모든 정보를 사용하여 클래스의 새 인스턴스 ReturnMessage 를 초기화합니다.

속성

Name Description
ArgCount

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

Args

원격 개체에서 호출된 메서드에 전달된 지정된 인수를 가져옵니다.

Exception

원격 메서드 호출 중에 throw된 예외를 가져옵니다.

HasVarArgs

호출된 메서드가 가변 개수의 인수를 허용하는지 여부를 나타내는 값을 가져옵니다.

LogicalCallContext

호출된 LogicalCallContext 메서드의 값을 가져옵니다.

MethodBase

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

MethodName

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

MethodSignature

메서드 시그니처를 포함하는 개체의 Type 배열을 가져옵니다.

OutArgCount

호출된 메서드의 out 인수 수 또는 ref 인수를 가져옵니다.

OutArgs

호출된 메서드에 매개 변수로 outref 전달된 지정된 개체를 가져옵니다.

Properties

현재ReturnMessageIDictionary 포함된 속성의 값을 가져옵니다.

ReturnValue

호출된 메서드에서 반환된 개체를 가져옵니다.

TypeName

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

Uri

원격 메서드가 호출된 원격 개체의 URI를 가져오거나 설정합니다.

메서드

Name Description
Equals(Object)

지정한 개체와 현재 개체가 같은지 여부를 확인합니다.

(다음에서 상속됨 Object)
GetArg(Int32)

메서드를 호출하는 동안 원격 메서드에 전달된 지정된 인수를 반환합니다.

GetArgName(Int32)

지정된 메서드 인수의 이름을 반환합니다.

GetHashCode()

기본 해시 함수로 작동합니다.

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

원격 메서드 호출 중에 매개 ref 변수로 out 전달된 개체를 반환합니다.

GetOutArgName(Int32)

원격 메서드에 전달된 지정된 out 매개 변수 또는 ref 매개 변수의 이름을 반환합니다.

GetType()

현재 인스턴스의 Type 가져옵니다.

(다음에서 상속됨 Object)
MemberwiseClone()

현재 Object단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)

적용 대상