How to put variables in c# attributes?

317 Views Asked by At

I am trying to create a xml-rpc client application using c#. However I need to make host address a variable. I am fairly new to c# and having difficulties when trying to add variables in attributes.

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);
} 

Now I want to add variable in

[XmlRpcUrl("hostAddress")] 

Are there any examples/references that are helpful?

1

There are 1 best solutions below

0
Swapnil Acharya On
ISumAndDiff proxy = (ISumAndDiff)XmlRpcProxyGen.Create(typeof(ISumAndDiff));
proxy.Url = "http://www.cookcomputing.com/SumAndDiff.rem";