Example
The IDL (Attribute.idl):
module Attribute
{
interface Greetings
{
attribute string Name;
readonly attribute string City;
string hello();
};
};
(Will be compiled into Attribute.cs)
The Implementation (ServerImpl.cs):
public class Greetings: Attribute.GreetingsPOA
{
private string m_strCity;
private string m_strName;
public Greetings()
{
m_strCity = "Hamburg";
}
public override string Name
{
set
{
m_strName = value;
}
get
{
return m_strName;
}
}
public override string City
{
get
{
return m_strCity;
}
}
public override string hello()
{
return "Greetings to " + m_strName;
}
}
The Client (ClientImpl.cs):
Write an attribute to the server:
oIGreetings.Name = "John";
Read an attribute from the server:
string strTheCity = oIGreetings.City;
Call a server method (reading a changed attribute):
string srLog = "\n" + oIGreetings.hello() + " from " + strTheCity;