【问题标题】:How to put variables in c# attributes?如何将变量放入c#属性中?
【发布时间】:2018-12-29 14:43:18
【问题描述】:

我正在尝试使用 c# 创建一个 xml-rpc 客户端应用程序。但是我需要使主机地址成为变量。我对 c# 还很陌生,在尝试在属性中添加变量时遇到了困难。

using CookComputing.XmlRpc;

public struct SumAndDiffValue 
{
    public int sum; 
    public int difference; 
}

[XmlRpcUrl("http://www.cookcomputing.com/sumAndDiff.rem")] 
public interface ISumAndDiff : IXmlRpcProxy
{ 
  [XmlRpcMethod] 
  SumAndDiffValue SumAndDifference(int x, int y);
} 

现在我想在

中添加变量
[XmlRpcUrl("hostAddress")] 

是否有任何有用的示例/参考资料?

【问题讨论】:

标签: c# xml-rpc xmlrpcclient


【解决方案1】:
ISumAndDiff proxy = (ISumAndDiff)XmlRpcProxyGen.Create(typeof(ISumAndDiff));
proxy.Url = "http://www.cookcomputing.com/SumAndDiff.rem";

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-12-16
    • 1970-01-01
    • 1970-01-01
    • 2012-01-17
    • 1970-01-01
    • 2011-07-02
    • 1970-01-01
    • 2021-09-24
    相关资源
    最近更新 更多