Custom Attribute
[AttributeUsage(AttributeTargets.Method)]
public class ProcMethodAttribute : ProcBaseAttribute
{
private string m_actionName;
public ProcMethodAttribute(string actionName)
{
if (actionName == null || actionName.Trim().Length == 0)
{
throw new ArgumentNullException("actionName");
}
m_actionName = actionName.Trim();
}
public string ActionName
{
get
{
return m_actionName;
}
}
}
Usage - "tagging" a method
public class TestProc
{
[ProcMethod("TestSendMessage")]
public void TestSendMessage(string someArg)
{
ProcCallContext.Current.SendMessage(
new OutMessage(0, "This is a returned message with arg: " + someArg + " and internal state: " + m_propString + ", " + m_propInt));
}
}