The question is about how to add some property to an object message without using inheritance and without changing base type. Here is what in my mind: Just suppose I have an object message to carry my message from service layer to front-end like this:
To clearance for you dear developers, I am not allowed inherit my result
from any interface or base class because as you see my result
type is object I want to keep it object and client which using these supposed the result is an object. We don't want change any thing in client side
public object DoSomething(param parameters)
{
.
list<MyObject> result= ...
return result;
}
Ok, Now in front-end I have:
public object GetResult(param parameters)
{
...
return _service.DoSomething(parameteres);
}
usage:
{
.
.
var result=GetResult(...);
if (**result.Status**==Success)
{
.
foreach(var item on result)
{
...
}
}
}
as you see for example I want to have a property like 'status' on my result or any other properties. I think using the something like proxy or some Aspect Programming techniques may help me What I need to add a property at runtime to an existing object - WITHOUT CHANGE OBJECT BASE CLASS OR IMPLEMENT ANY OTHER INTERFACE