RemotingServices.IsOneWay(MethodBase) 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
지정된 메시지에 지정된 메서드를 호출한 클라이언트가 실행을 계속하기 전에 서버가 메서드 처리를 완료하기를 기다리고 있는지 여부를 나타내는 부울 값을 반환합니다.
public:
static bool IsOneWay(System::Reflection::MethodBase ^ method);
public static bool IsOneWay(System.Reflection.MethodBase method);
[System.Security.SecurityCritical]
public static bool IsOneWay(System.Reflection.MethodBase method);
static member IsOneWay : System.Reflection.MethodBase -> bool
[<System.Security.SecurityCritical>]
static member IsOneWay : System.Reflection.MethodBase -> bool
Public Shared Function IsOneWay (method As MethodBase) As Boolean
매개 변수
- method
- MethodBase
문제의 메서드입니다.
반품
true메서드가 한 가지 방법인 경우 그렇지 않으면 . false
- 특성
예외
즉시 호출자에게 인프라 권한이 없습니다.
예제
public ref class HelloServer: public MarshalByRefObject
{
public:
HelloServer()
{
Console::WriteLine( "HelloServer activated." );
}
[OneWay]
void SayHelloToServer( String^ name )
{
Console::WriteLine( "Client invoked SayHelloToServer(\" {0}\").", name );
}
// IsOneWay: Note the lack of the OneWayAttribute adornment on this method.
[SecurityPermissionAttribute(SecurityAction::Demand, Flags=SecurityPermissionFlag::Infrastructure)]
String^ SayHelloToServerAndWait( String^ name )
{
Console::WriteLine( "Client invoked SayHelloToServerAndWait(\" {0}\").", name );
Console::WriteLine( "Client waiting for return? {0}", RemotingServices::IsOneWay( MethodBase::GetCurrentMethod() ) ? (String^)"No" : "Yes" );
return String::Format( "Hi there, {0}.", name );
}
};
public class HelloServer : MarshalByRefObject {
public HelloServer() {
Console.WriteLine("HelloServer activated.");
}
[OneWay()]
public void SayHelloToServer(string name) {
Console.WriteLine("Client invoked SayHelloToServer(\"{0}\").", name);
}
// IsOneWay
// Note the lack of the OneWayAttribute adornment on this method.
public string SayHelloToServerAndWait(string name) {
Console.WriteLine("Client invoked SayHelloToServerAndWait(\"{0}\").", name);
Console.WriteLine(
"Client waiting for return? {0}",
RemotingServices.IsOneWay(MethodBase.GetCurrentMethod()) ? "No" : "Yes"
);
return "Hi there, " + name + ".";
}
}
Public Class HelloServer
Inherits MarshalByRefObject
Shared Sub New()
Console.WriteLine("HelloServer activated.")
End Sub
<OneWay()> Public Sub SayHelloToServer(ByVal name As String)
Console.WriteLine("Client invoked SayHelloToServer(""{0}"").", name)
End Sub
'IsOneWay
' Note the lack of the OneWayAttribute adornment on this method.
<SecurityPermission(SecurityAction.Demand)> _
Public Function SayHelloToServerAndWait(ByVal name As String) As String
Console.WriteLine("Client invoked SayHelloToServerAndWait(""{0}"").", name)
Console.WriteLine( _
"Client waiting for return? {0}", _
IIf(RemotingServices.IsOneWay(MethodBase.GetCurrentMethod()), "No", "Yes") _
)
Return "Hi there, " + name + "."
End Function
End Class
설명
단방향 메서드가 호출되면 클라이언트는 서버가 메시지 처리를 완료할 때까지 기다리지 않습니다. 클라이언트 메서드는 서버가 메시지를 성공적으로 처리할지 여부를 모르고 애플리케이션으로 돌아갑니다. 메서드는 .를 사용하는 OneWayAttribute한 가지 방법으로 표시됩니다.
단방향 메서드는 반환 값이나 출력 매개 변수를 가질 수 없습니다.