방법: 클라이언트 활성 형식의 인스턴스 만들기
이 코드 예는 클라이언트 활성 형식의 인스턴스를 만드는 방법을 보여 줍니다. 이 예에서는 TcpChannel이 포트 8080에서 수신하도록 등록되어 있는 것으로 가정합니다.
예제
Dim Object() = {New UrlAttribute("tcp://computername:8080/RemoteObjectApplicationName ")}
' Note that the second parameter (Nothing) specifies that no arguments
' are being passed.
Dim MyRemoteClass As RemoteObjectClass = _
CType( _
Activator.CreateInstance(GetType(RemoteObjectClass), Nothing, url), _
RemoteObjectClass)
object[] url = {new UrlAttribute("tcp://computername:8080/RemoteObjectApplicationName")};
// Note that the second parameter (null) specifies that no arguments
// are being passed.
RemoteObjectClass MyRemoteClass = (RemoteObjectClass)Activator.CreateInstance(
typeof(RemoteObjectClass),
null,
url
);
코드 컴파일
이 예에서는 다음 사항이 필요합니다.
- System 및 System.Runtime.Remoting.Activation 네임스페이스에 대한 참조, 그리고 RemoteObjectClass를 구현하는 네임스페이스