IMethodReturnMessage 인터페이스
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
메서드 호출 반환 메시지 인터페이스를 정의합니다.
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 개체에서 호출된 메서드의 결과로 생성되며 메서드 호출 결과를 호출자에게 반환하는 데 사용됩니다.
속성
| Name | Description |
|---|---|
| ArgCount |
메서드에 전달된 인수 수를 가져옵니다. (다음에서 상속됨 IMethodMessage) |
| Args |
메서드에 전달된 인수의 배열을 가져옵니다. (다음에서 상속됨 IMethodMessage) |
| Exception |
메서드 호출 중에 throw된 예외를 가져옵니다. |
| HasVarArgs |
메시지에 변수 인수가 있는지 여부를 나타내는 값을 가져옵니다. (다음에서 상속됨 IMethodMessage) |
| LogicalCallContext |
LogicalCallContext 현재 메서드 호출에 대한 값을 가져옵니다. (다음에서 상속됨 IMethodMessage) |
| MethodBase |
호출된 MethodBase 메서드의 값을 가져옵니다. (다음에서 상속됨 IMethodMessage) |
| MethodName |
호출된 메서드의 이름을 가져옵니다. (다음에서 상속됨 IMethodMessage) |
| MethodSignature |
메서드 시그니처를 포함하는 개체를 가져옵니다. (다음에서 상속됨 IMethodMessage) |
| OutArgCount |
메서드 호출에서 매개 변수로 |
| OutArgs |
매개 변수 또는 매개 변수로 표시된 지정된 인수를 |
| Properties |
IDictionary 메시지 속성의 컬렉션을 나타내는 값을 가져옵니다. (다음에서 상속됨 IMessage) |
| ReturnValue |
메서드 호출의 반환 값을 가져옵니다. |
| TypeName |
호출을 대상으로 하는 특정 개체의 전체 Type 이름을 가져옵니다. (다음에서 상속됨 IMethodMessage) |
| Uri |
호출을 대상으로 하는 특정 개체의 URI를 가져옵니다. (다음에서 상속됨 IMethodMessage) |
메서드
| Name | Description |
|---|---|
| GetArg(Int32) |
특정 인수를 .로 가져옵니다 Object. (다음에서 상속됨 IMethodMessage) |
| GetArgName(Int32) |
메서드에 전달된 인수의 이름을 가져옵니다. (다음에서 상속됨 IMethodMessage) |
| GetOutArg(Int32) |
매개 변수 또는 매개 변수로 표시된 지정된 인수를 |
| GetOutArgName(Int32) |
매개 변수로 |