ex-19-06
来自「Programming Csharp Source Code(代码) Prog」· 代码 · 共 26 行
TXT
26 行
// Example 19-06: Marshaling an object without a well-known endpoint
public static void Main()
{
// create a channel and register it
HttpChannel chan = new HttpChannel(65100);
ChannelServices.RegisterChannel(chan);
// make your own instance and call Marshal directly
Calculator calculator = new Calculator();
ObjRef objRef = RemotingServices.Marshal(calculator);
FileStream fileStream =
new FileStream("calculatorSoap.txt",FileMode.Create);
SoapFormatter soapFormatter = new SoapFormatter();
soapFormatter.Serialize(fileStream,objRef);
fileStream.Close();
// "They also serve who only stand and wait."); (Milton)
Console.WriteLine(
"Exported to CalculatorSoap.txt. Press ENTER to exit...");
Console.ReadLine();
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?