public void MyServiceMethod(DvInvocation invocation) { string myArg = null; try { myArg = invocation.Read(0); // Read the first argument as a string } catch (Exception e) { invocation.ReportError(ErrorCode.ActionFailed, e.Message); return; } // Do something with myArg... }
public void MyServiceMethod(DvInvocation invocation) { string myReturnValue = "Hello world!"; invocation.Write(myReturnValue); // Write the return value invocation.Return(); }This example demonstrates how to use the Write method to write the return value of a service method invocation, which can then be read by the client using the ReadEnd method. The DvInvocation class is part of the OpenHome.Net library, which is used for building UPnP and DLNA compatible devices and services in C#.