public class MyService : IDisposable { private readonly OpenHome.Net.Core.Action iMyAction; public MyService() { iMyAction = new OpenHome.Net.Core.Action("MyAction", new OpenHome.Net.Core.ActionDelegate(MyAction)); } public OpenHome.Net.Core.Action OutputAction { get { return iMyAction; } } private void MyAction(out string aResult) { aResult = "Hello world"; } }
public class MyService : IDisposable { private readonly OpenHome.Net.Core.Action iMyAction; public MyService() { iMyAction = new OpenHome.Net.Core.Action("MyAction", new OpenHome.Net.Core.ActionInput("Input", OpenHome.Net.Core.Function.TUint), new OpenHome.Net.Core.ActionOutput("Output", OpenHome.Net.Core.Function.TUint), new OpenHome.Net.Core.ActionDelegate(MyAction)); } public OpenHome.Net.Core.Action OutputAction { get { return iMyAction; } } private void MyAction(uint aInput, out uint aOutput) { aOutput = aInput + 1; } }In this example, we create a service with an action "MyAction" that takes a uint input parameter "Input" and returns a uint output parameter "Output". The action implementation adds 1 to the input and sets the output parameter to the result. Package library: OpenHome.Net.Core.